Commit Graph

2553 Commits

Author SHA1 Message Date
Wesley Wigham
6b7bf5e22c Do not rely on ElementAttributeProperty if it is not present (#22936)
* Do not rely on ElementAttributeProperty if it is not present

* Fix bug

* Fix nits and lint
2018-03-29 16:19:55 -07:00
Wesley Wigham
1ed30c6d4d Elide type reference comments which are also imported (#22752)
* Elide type reference comments which are also imported

* Explicit undefined

* Accept reordered symbols
2018-03-29 16:15:55 -07:00
Wesley Wigham
ea8904e33d Propagate noDefaultLib comment into emitted declaration files (#23003) 2018-03-29 15:38:29 -07:00
Ryan Cavanaugh
5af72b5f02 Merge pull request #22993 from dhruvrajvanshi/issue-22785
Issue 22785
2018-03-29 15:10:04 -07:00
Wesley Wigham
793f4696a4 Fall back to check expression if resolving an export assigned entity name fails (#22928)
* Fall back to check expression if resolving an export assigned entity name fails

* Comments from code review

* Add back in assertion

* Remove nameNotFoundMessage check from resolveName isReferenced check (rely on just isUse instead)
2018-03-29 13:54:12 -07:00
Wesley Wigham
3acafe5f42 Consider property accesses in heritage clauses as type-space references for calculating type reference directives (#22746) 2018-03-29 13:51:52 -07:00
Wesley Wigham
43a482f03f Emit amd-module and amd-dependency comments in emitter if printing declaration comments (#22740)
* Emit amd-module and amd-dependency comments in emitter if printing declaration comments

* Move code a bit

* Move again
2018-03-29 13:43:31 -07:00
Wesley Wigham
509a53fea7 Propagate CheckFlags.Late through instantiateSymbol (#22749) 2018-03-29 13:42:26 -07:00
Wesley Wigham
411c59a8ef Copy comments from inferred types to generated nodes (#22730) 2018-03-29 13:38:36 -07:00
Wesley Wigham
64ee623fd6 NodeBuilder only preserves parameter modifiers for constructors (#22706) 2018-03-29 13:34:07 -07:00
Andy
9d713b6db6 Error on rest parameter with trailing comma (#22262)
* Error on rest parameter with trailing comma

* Error on binding patterns and improve error location
2018-03-29 13:12:23 -07:00
Wesley Wigham
51a4fe6d20 Handle ts-only declaration export aliases in system transformer (#22919)
* handle ts declarations export alises in system transformer

* Retain end of declaration marker
2018-03-29 12:50:29 -07:00
Wesley Wigham
3365272f69 Dont follow aliases when looking for default exported symbol (#22995) 2018-03-29 12:46:31 -07:00
Wesley Wigham
51d44b6097 Move JSX props support check and make syntactic (#22970)
* Move JSX props support check and make syntactic

* Make parameter required
2018-03-29 12:36:42 -07:00
Dhruv Rajvanshi
866c542522 Adding trailing newline to a baseline test file 2018-03-30 00:00:18 +05:30
Wesley Wigham
6c517ef276 Dont let an import that doesnt need helpers override one that does (#22966) 2018-03-29 11:03:33 -07:00
Wesley Wigham
5c49133382 Add regression tests documenting current behavior of #14121 (#22748) 2018-03-29 11:01:05 -07:00
Dhruv Rajvanshi
ac97987ee0 Allow strict mode reserved keywords in qualified type names; Fixes 22785 2018-03-29 22:59:58 +05:30
Wenlu Wang
cb9f436b54 fix accessor parse with line terminator (#22893) 2018-03-28 10:59:09 -07:00
Wesley Wigham
ddb7bb22dc Add regression test for GH #21871 (#22733) 2018-03-27 19:28:58 -07:00
Mohamed Hegazy
4699c829de Merge pull request #22898 from Kingwl/fix-return-type-lookup-rule
fix type lookup rule
2018-03-27 17:01:56 -07:00
Wesley Wigham
1db769d566 Transform setter bodies if they contain es2015 (#22931) 2018-03-27 15:16:56 -07:00
Kevin Donnelly
4fa96056ea Make T[never] = never instead of erroring or being any (#22787)
* Add tests showing existing behavior for indexing types with never.

* Make T[never] = never instead of erroring or being any.

And update the baselines for the tests for this change.

* Add test case for indexing an expression with never showing existing behavior.

* Make indexing an object with never expression result in never.

And update baseline to reflect new behavior.
2018-03-27 07:45:25 -07:00
王文璐
9b7e5e212f fix type lookup rule 2018-03-27 17:37:19 +08:00
Wesley Wigham
dcbc478efa Tighten heuristic for definite dts moduleness to check for syntactic default (#22814)
* Tighten heuristic for definite dts moduleness to check for syntactic default exports

* Inline function
2018-03-26 16:35:03 -07:00
Mohamed Hegazy
faa3fca247 Merge pull request #22886 from Microsoft/Fix22866
Fix #22866: Condition checking for name collision of generated variable names on emit happening
2018-03-26 14:24:59 -07:00
Mohamed Hegazy
7fd602e594 Fix #22866: Condition checking for name collision of generated variable names on emit happening 2018-03-26 13:02:09 -07:00
Wesley Wigham
6af764c560 Declaration maps and transparent goto definition using them (#22658)
* Add compiler option to enable declaration sourcemaps

* Transparent goto definition for sourcemapped declaration files

* Post-rebase touchups

* Rename API methods

* Fix lints

* Fix typo in name XD

* Log sourcemap decode errors

* Share the cache more, but also invalidate it more

* Remove todo

* Enable mapping on go to implementation as well

* Allow fourslash to test declaration maps mroe easily

* more test

* Handle sourceRoot

* Add tests documenting current behavior with other sourcemapping flags

* Ignore inline options for declaration file maps, simplify dispatch in emitter

* Change program diagnostic

* Fix nit

* Use charCodeAt

* Rename internal methods + veriables

* Avoid filter

* span -> position

* Use character codes

* Dont parse our sourcemap names until we need to start using them

* zero-index parsed positions

* Handle sourceMappingURL comments, including base64 encoded ones

* Unittest b64 decoder, make mroe robust to handle unicode properly

* Fix lint

* declarationMaps -> declarationMap

* Even more feedback

* USE Mroe lenient combined regexp

* only match base64 characters

* Fix nit
2018-03-26 12:15:34 -07:00
Anders Hejlsberg
c2a53f90de Add regression tests 2018-03-23 17:41:55 -07:00
Anders Hejlsberg
1c2f3d228c Add regression test 2018-03-23 09:48:00 -07:00
Wesley Wigham
ca1d19a579 Always make a new jsxAttributes type, dont reuse emptyObjectType (#22810)
* Always make a new jsxAttributes type, dont reuse emptyObjectType

* Break up conditional a bit
2018-03-22 15:16:33 -07:00
Wesley Wigham
a7b066fe04 Allow local class declarations to be returned as mixins (#22807) 2018-03-22 15:02:54 -07:00
Andy
94570eedcc Don't provide spelling suggestion for module (#22805) 2018-03-22 14:27:34 -07:00
Nathan Shively-Sanders
de4a69cb72 In source files and blocks, bind function declarations before other statements (#22766)
* Add test case and temporarily disable inference

(Inference of class members from this-assignments inside a
prototype-assigned function.)

* Update baselines

* In blocks and source files, bind functions first

* Add tests from other bugs

* Remove temporary failsafe

* Update tests to restore intent and clean up errors

* Restore intent even better

* Restore intent even better x2

* Add missed baselines
2018-03-21 14:22:09 -07:00
Nathan Shively-Sanders
c930895d80 Undo 'any' inference propagation (#22736)
* Undo 'any' inference propagation

Removing this only changes one test slightly, and fixes JQuery types,
which rely on the old method of inference.

* Add jquery regression test and update baselines

* Restore any inference propagation to wildcard only
2018-03-21 11:13:39 -07:00
Anders Hejlsberg
979bda484c Add regression test 2018-03-17 12:23:45 -07:00
Wesley Wigham
2d01d76ee5 Change es2015 transform to retain comments on for of loop bodies (#22396) 2018-03-16 12:57:38 -07:00
Andy
e48bcd60ba Treat 'yield;' as 'yield undefined;' (#22297)
* Treat 'yield;' as 'yield undefined;'

* Use undefinedWideningType
2018-03-08 15:41:04 -08:00
Wesley Wigham
87d88e2ba3 Handle resolving and unknown symbols in getLiteralTypeFromPropertyName (#22406) 2018-03-08 13:35:55 -08:00
Wesley Wigham
95862880fb Filter symbol property names out of index signature assignability checks (#22398) 2018-03-08 09:30:25 -08:00
Wesley Wigham
45eaf42006 Use single replacer for string escaping (#22335) 2018-03-07 17:36:31 -08:00
Andy
1f7a5097fa When every import is unused, error on the entire import declaration (#22386)
* When every import is unused, error on the entire import declaration

* Code review

* Store key in map value
2018-03-07 14:42:09 -08:00
Wesley Wigham
2f0a13c7c3 Use global NonNullable type for nonnull types (#22096)
* Use NonNullable type for nonnull types

* Add noLib test

* Remove conditional type fallback for when lib is not present
2018-03-05 14:52:06 -08:00
Andy
4ddf045d6a For <div a= >, after =, do not try to parse an expression (#21373) 2018-03-05 14:38:55 -08:00
Wesley Wigham
16bf02991d Allow indexing generics with unique symbols (#22339)
* Allow indexing generics with unique symbols

* Move condition to assert
2018-03-05 13:58:19 -08:00
Wesley Wigham
53ae507545 Add inference priority for mapped type keys (#22246)
* Add inference priority for mapped type keys

The new priority causes union inference, similarly to return type

* Rename priority

* Fix comment typo
2018-03-05 13:19:00 -08:00
Sheetal Nandi
6e756b5907 Merge pull request #22308 from Microsoft/declarationEmitOfIndirectAlias
Fix incorrect error reported when using type from indirect module alias and current module is exported with "export default"
2018-03-02 19:10:36 -08:00
Wesley Wigham
1c93744a9c Much better comment preservation (#22141)
* Retain comments on (and produce sourcemaps on) the equals token in initializers

* Improved comments/sourcemaps for await, yield, while, and for

* Retain comments on block curly-braces

* Emit comments for if statements

* Improved switch case comment emit

* Improve comment and sourcemap emit for try/catch, throw, and continue statements

* Improve sourcemap emit and comments for with statements

* More accurate sourcemaps+comments emit for new, typeof, void, and delete

* Improve comment emit for element access expressions

* Preserve more comments on imports and exports

* Make function a bit more defensive like other usages of emitTrailingCommentsOfPosition

* Support preserving comments within empty lists

* Handle leading comments of tokens, conditionally indent leading comments

* Stop heuristically sourcemapping tokens

When the transform was trivial it worked, but was unneeded, but when it was complex, it was brittle - best leave source mapping up to the transformers

* Fix unneeded +1

* Tighten up element access comments

* Handle comments on parenthesized expression tokens

* Fix nit
2018-03-02 17:23:59 -08:00
Sheetal Nandi
dc7ee381d5 Add tests when declaration emit for indirect alias usuage results in wrong error reporting
Test for #22257
2018-03-02 16:10:34 -08:00
Wesley Wigham
b8e0009c9b Set syntheticLiteralTypeOrigin on synthetic undefined-type members (#22216)
* Have getNameOfSymbolAsWritten quote nonidentifier nonnumeric symbols all the time

* Revert checker changes

* Reuse synthetic origin to indicate that derived declaration name may need to be quoted
2018-02-28 16:03:05 -08:00