Commit Graph

2594 Commits

Author SHA1 Message Date
Wesley Wigham
9c40d276ab Downlevel destructuring in module transformer if destructured variable has multiple names (#23832)
* Downlevel destructuring in module transformer if destructured variable has multiple names

* Alter indentation
2018-05-02 16:20:47 -07:00
Wesley Wigham
b5b7fc4f1d Flag default imports with named imports as needing importStar (#23795)
* Flag default imports with named imports as needing importStar

* Restructure helpers a bit, add double-default testcase
2018-05-02 16:20:34 -07:00
Wesley Wigham
c663645c91 Inform getDeclarationSpaces about how an imported exportAssignment may merge (#23816) 2018-05-01 17:24:30 -07:00
Wesley Wigham
0c244d86b3 Add used-before-declaration errors for class refs inside computed names (#23784) 2018-04-30 12:55:30 -07:00
Mohamed Hegazy
2c956af927 Merge pull request #23664 from a-tarasyuk/feature/strictPropertyInitialization-can-not-be-used-without-strictNullChecks
Add warn that user can not use --strictPropertyInitialization without --strictNullChecks
2018-04-30 12:10:54 -07:00
Anders Hejlsberg
0dc42fea74 Add regression tests 2018-04-30 10:43:55 -07:00
Wesley Wigham
8c5ad2429a Relax switch-case narrowing restrictions (#23522)
* Allow switch case narrowing even when individual clauses are nonunit

* And remove unit type restriction

* Rename
2018-04-27 16:30:43 -07:00
Wesley Wigham
47385b29e0 Actually visit expression node on empty destructuring assignment (#23744) 2018-04-27 15:55:53 -07:00
Wesley Wigham
6d3b6e21da Add implicit any errors for destructuring computed names which aren't late bound and have no corresponding index (#23489)
* Add implicit any errors for destructuring computed names which arent late bound and have no corresponding index

* Add string fallback for number

* Expand test case, make functionality mimic other (buggy) areas

* Add symbol name errors to bring in line with new indexing rules
2018-04-27 15:55:32 -07:00
Wesley Wigham
d5ef1174bd Copy consistient valueDeclarations on union/intersection symbols (#23190) 2018-04-27 13:12:35 -07:00
Alexander T
f04a18ae5b Add tests 2018-04-26 20:18:24 +03:00
Wesley Wigham
4a6888a850 There exist type parameters with symbols but without TypeParameterDeclaration nodes (#23690)
* There exist type parameters with symbols but without TypeParameterDeclaration nodes

* Add test
2018-04-25 15:53:06 -07:00
Nathan Shively-Sanders
905f9a02ad module.exports = Entity is an alias, just like export = Entity (#23570)
* Make `module.export =` an alias like `export=` is

This breaks a couple of tests for previous workarounds. Fix in upcoming
commits.

* Basically fixes all the breaks, but needs cleanup

* More notes to myself

* Clean up TODOs

* Call mergeSymbolTable and delete export= afterward

instead of basically copying the code myself.

* More cleanup

* Remove unnecessary check in import type checking

* Revert to DIY code.

It is more correct and will go away in a few days.

* Exported class expressions can be used as type

In both JS and TS

* Do not require named class expressions
2018-04-23 15:24:31 -07:00
Anders Hejlsberg
0179d97403 Merge pull request #23592 from Microsoft/improveIndexTypes
Support number and symbol named properties with keyof and mapped types
2018-04-23 13:22:56 -07:00
Wesley Wigham
eb112ab492 Deduplicate declarations in combined type/value symbols (#23593) 2018-04-21 12:50:05 -07:00
Wesley Wigham
557a34e897 Visit typedef type expressions so they contribute to referenced-ness (#23525) 2018-04-19 10:28:30 -07:00
Wesley Wigham
238ed7a94c Visit EOF to collect jsdoc import types (#23521)
* Visit EOF to collect jsdoc import types

* Add flag to prevent jsdoc import types from influencing compilation set
2018-04-18 19:52:34 -04:00
Anders Hejlsberg
5f0d88096c Update test 2018-04-18 15:43:32 -07:00
Anders Hejlsberg
16cd5580a6 Merge branch 'master' into improveIndexTypes
# Conflicts:
#	src/compiler/checker.ts
#	src/server/utilities.ts
2018-04-16 16:18:29 -07:00
Wesley Wigham
8a2b4646f0 Include guards on comment kind in pragma extraction (#23313) 2018-04-10 20:50:31 -07:00
Wesley Wigham
b2e0c4bea6 Add support for destructuring well-known and late-bound names (#23297)
* Add support for destructuring well-known and late-bound names

* Add test of not present late bound prop
2018-04-10 18:21:24 -07:00
Wesley Wigham
1243d1a9ba handle any'd method signature types (ie, from special property declarations) (#23316) 2018-04-10 18:17:57 -07:00
Wesley Wigham
83ab341531 Allow variable statements used as declaration sites to be marked visible (#22798)
* Allow variable statements used as declaration sites to be marked visible and included in declaration emit by alias marking

* Dont forget to transform statements

* Accept baselines

* Accept updated baselines for new test

* Emit scope fix markers

* Add partial private variable declaration emit test
2018-04-09 14:30:40 -07:00
Anders Hejlsberg
0379666bbf Update tests 2018-04-09 08:51:55 -10:00
Mohamed Hegazy
da312398f5 Merge pull request #23050 from gagoman/fix/22923
Fix issue #22923
2018-04-06 09:31:43 -07:00
Alex Khomchenko
134b3411ee Fix issue #22923 2018-04-05 21:39:33 +02:00
Nathan Shively-Sanders
154ac342cb Allow extending any, with noImplicitAny errors (#23153)
Allow extending any, without noImplicitAny errors
2018-04-05 08:52:56 -07:00
Wesley Wigham
de669cf827 Only include unique symbols when getting index types for access checks (#23145)
* Only include unique symbols when getting index types for access checks

* Filter all nonstrings

* Inline ternary
2018-04-04 18:03:21 -07:00
Nathan Shively-Sanders
dca3a94f88 Print js-constructor function type names (#23089)
* Print js-constructor function type names

Instead of printing them as a type literal, which is scary.

* Use assigned name for functions and classes

That otherwise have no name. This helps quick info for javascript a
*lot*. Typescript mainly benefits when printing the type of class
expressions.

* Improve names of functions in binding elements

Also fix some fourslash baselines
2018-04-04 15:43:41 -07:00
Wesley Wigham
9b987eb947 Dont bind a local symbol for a default export without a name (#23152) 2018-04-04 15:26:10 -07:00
Nathan Shively-Sanders
6b158de866 No error referring to UMD symbol in CommonJS modules (#23129) 2018-04-03 16:10:09 -07:00
Wesley Wigham
78ba32a110 Allow multiple class base types; intersect them, as with interfaces (#23123) 2018-04-03 16:08:52 -07:00
Wesley Wigham
343bb5ac70 Actuallt preserve nonblock for of statements in forofs with object rest (#23122) 2018-04-03 13:32:42 -07:00
Wesley Wigham
cbce76ed13 Consider jscontainer aliases as referencible even if they have other local meanings (#23119) 2018-04-03 12:27:16 -07:00
Wesley Wigham
9b558f9535 Remove _this, _super, and _newTarget name conflict errors (#22890)
* Add new generated name kind for reused transpiler variables

* Remove error on _super or _newTarget conflict

* Add test with super helper conflict

* Remove error on _this conflict

* Fix lint

* Use flags instead of generated kinds, inline some things

* Accept rename

* Remove trailing whitespace

* Move helper emit into printer, rather than emitter"

* passthru module and target

* New test, accept baselines

* Make members private
2018-03-30 17:43:37 -07:00
Wesley Wigham
8543d30372 Add union check to improved error message (#23027) 2018-03-30 16:23:24 -07:00
Wesley Wigham
a53f9e8ec3 Call ensureModifiers on private property modifiers (#23026) 2018-03-30 16:07:09 -07:00
Mohamed Hegazy
31c3ef51d3 Merge pull request #22251 from jack-williams/jack-williams/no-implicit-symbol-to-string
Fix #19666: Check for symbol types in template expressions
2018-03-30 09:32:11 -07:00
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