Commit Graph
2546 Commits
Author SHA1 Message Date
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
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
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
Wesley Wigham 62185673fd Emit unqiue symbols with typeof if possible before issuing an error (#21403) 2018-02-28 15:44:12 -08:00
Wesley Wigham 7a31192ecb Stop binding type predicate types twice (#22210) 2018-02-28 15:43:13 -08:00
Wesley Wigham c1128d6957 Fix declaration emitted crash on mapped type with no type (#22213) 2018-02-27 16:12:03 -08:00
Wesley Wigham 0dc5f18bdb Remove excess comment ranges from initialized and property parameter emit (#22152) 2018-02-26 12:43:31 -08:00
Alex Eagle 2e66e74e14 fix --pretty output when context is multi-line
Fixes #22097
2018-02-22 22:56:00 -08:00
Wesley Wigham 66fa9f6cd7 Just map type variables to constraints at certain positions for narrowing so that we do not map primitives (#21384)
* Use a limited version of getApparentType that doesnt map primitives

* Reuse [most of]  getBaseConstraintOfType, since it does the needed behaviors

* Move new function next to the very similar function
2018-02-21 12:51:26 -08:00
Andy 9ee51fadd9 Have Symbol#isReferenced check the SymbolFlags of the reference (#21996) 2018-02-16 16:47:13 -08:00