Commit Graph

15276 Commits

Author SHA1 Message Date
Nathan Shively-Sanders
cf3e28ea66 Revert "feat(40197): handle uncalled function checks in binary expressions (#40260)"
This reverts commit eaf4f46c17.
2020-10-07 14:14:49 -07:00
Alex T
eaf4f46c17 feat(40197): handle uncalled function checks in binary expressions (#40260) 2020-10-07 14:06:42 -07:00
Nathan Shively-Sanders
4283428906 Fix export binding of namespaced typedefs (#40980)
The binder incorrectly rejected implicit namespace declarations in
typedefs.
2020-10-07 13:21:02 -07:00
Wesley Wigham
4dc7e59248 Merge pull request #40953 from weswigham/improve-completions-large-literal-perf
Improve the performance of requesting completions within a massive array literal
2020-10-07 12:44:20 -07:00
Nathan Shively-Sanders
fc783a9000 Fix missed tasks to add esnext.weakref (#40981)
Follow up to #38232, based on #33844
2020-10-07 11:06:04 -07:00
Anders Hejlsberg
f34220980b Add isDeeplyNestedType logic to getResolvedBaseConstraint (#40971)
* Add isDeeplyNestedType logic to getResolvedBaseConstraint

* Accept new baselines

* Add regression test

* Accept new baselines

* Fix lint issue
2020-10-07 05:50:06 -07:00
Wesley Wigham
3df8bc6a03 Rephrase to use binarySearchKey 2020-10-06 12:29:58 -07:00
Sheetal Nandi
d94b8e42a6 Fixes calculating resolved project reference to redirect for module resolution (#40954)
* Add test for #38711

* Fixes calculating resolved project reference to redirect for module resolution
Fixes #38711

* Update src/compiler/program.ts
2020-10-06 11:23:05 -07:00
Alex T
0c7d45a9ed fix: change deprecated FunctionLike type to SignatureDeclaration (#40795) 2020-10-06 07:51:01 -07:00
Vincent Boivin
57661607e9 fix(40929) PromiseConstructor error message for newer versions of ECMAScript (#40931)
* Update package-lock.json

* Update package-lock.json

* Update package-lock.json

* Update package-lock.json

* Fixes #40929

Co-authored-by: TypeScript Bot <typescriptbot@microsoft.com>
2020-10-05 16:38:12 -07:00
Tiago Tristao
1191e2e731 Fix class expression from being assignable if types don't match (#40660)
* Fix class expression from being assignable if types don't match

* Fix class expression from being assignable if types don't match
2020-10-05 13:21:38 -07:00
Wesley Wigham
77df9faabf Merge pull request #40886 from weswigham/error-on-anonymous-type-with-nonlocal-unique-symbol
Limit when we allow nested unique symbols to be serialized
2020-10-05 11:59:45 -07:00
Orta Therox
dd84bc1dc9 Handles creating a reasonable AST when destructuring into a parens'd expresssion (#40115)
* Handles creating a lgical AST when destructuring  into a parens

* Adds an async example
2020-10-05 14:12:47 -04:00
Vincent Boivin
61aadc4ce2 fix(40320): Better errors when using properties/methods from newer versions of ECMAScript (#40650)
* Update package-lock.json

* Suggesting a library for a missing property/method

* Added more types and added tests

* Added more tests to cover all the latest features

* Added bigintarrays and dataview methods

* Fixed typo in template

* Transform old error message to use 2nd template slot

* Removed test that has been split up between es2015 and es2016+

* Use empty arrays and remove unnecessary function call

* merge

* Added early bail-out and updated baselines

* Implemented early bail-out (misread)

Co-authored-by: TypeScript Bot <typescriptbot@microsoft.com>
2020-10-02 16:47:37 -07:00
Richa Deshmukh
b748484031 #40763 Fixed: Bad error message when forgetting a comma in an array of templ… (#40907)
* #40763 Bad error message when forgetting a comma in an array of template strings

* Code review fixes
2020-10-02 15:37:59 -07:00
Sheetal Nandi
5ecdcef4ce Remove unnecessary requirement for createHash since we already handle absence of it (#40891) 2020-10-02 10:56:33 -07:00
Wesley Wigham
6a5527e0c6 Properly compare path prefixes when generating module paths (#40885) 2020-10-02 10:50:30 -07:00
Nathan Shively-Sanders
477e4b1a9d Fix function merged with export as namespace sourcefile (#40908)
Previously it crashed because the function-checking code didn't expect
a node with no parent.
2020-10-02 10:50:12 -07:00
Nathan Shively-Sanders
b8ebad48d7 Fix recursive types in @typedef (#40861)
* Fix reference types in @typedef

Previously this code path was broken and untested. Fortunately the fix
is simple.

* add test case from #40234

* update baselines
2020-10-02 08:46:42 -07:00
Sai Geetha Kandepalli Cherukuru
0ba250dc3b Updated error message for TS1031 (#40889)
Co-authored-by: Sai Geetha <sai.geetha@ssi.samsung.com>
2020-10-01 16:37:14 -07:00
Wesley Wigham
b86dc34386 Limit when we allow nested unique symbols to be serialized to when their declaration is within the same file as the context 2020-10-01 15:20:01 -07:00
Wesley Wigham
e9465c5de5 Properly compare path prefixes when generating module paths 2020-10-01 14:56:32 -07:00
Wesley Wigham
da86332120 Limit export= js declaration emit to only json source files (#40882) 2020-10-01 14:55:24 -07:00
Wesley Wigham
3ea81e652a Ensure whitespace jsx elements are not counted when determining if a jsx child is the only child (#40839)
* Ensure whitespace jsx elements are not counted when determining if a jsx child is the only child

* Use filtered children count for deciding constructor used

* Accept updated baselines post-merge
2020-10-01 14:36:44 -07:00
Andrew Branch
5fbe9806db Fix noUncheckedIndexedAccess with tuple rest types and generic index types (#40681)
* Fix noUncheckedIndexedAccess for tuple rest elements

* Defer inclusion of undefined for generic indexed access types

* Create separate IndexedAccessTypes depending on whether --noUncheckedIndexedAccess applies

* Undo accidental export

* Parenthesize for clearer precedence
2020-10-01 13:56:13 -07:00
Anders Hejlsberg
950dad9c29 Propagate wildcard types in template literal type construction (#40875)
* Propagate wildcard types in template literal type construction

* Add regression test

* Accept new baselines
2020-10-01 13:36:08 -07:00
Wesley Wigham
b93da6291a Emit non-identifier enum member references as typeof parent[some name] (#40679) 2020-10-01 13:06:17 -07:00
Wesley Wigham
798b18be6e Add extensions to jsx automatically added import, per babel change (#40871) 2020-10-01 12:03:13 -07:00
Anders Hejlsberg
4538e7352f Properly distribute over unions in keyof for mapped types with as clause (#40837)
* Properly distribute over unions in keyof mapped types with as clause

* Accept new baselines

* Add regression test

* Accept new baselines
2020-10-01 09:36:51 -07:00
Andrew Casey
35111231f7 Merge pull request #40755 from amcasey/SpreadLimit
Enforce a size limit in getSpreadType
2020-09-30 13:44:59 -07:00
Tim van der Lippe
070cf1112f Remove duplicate comment (#40667) 2020-09-30 09:41:31 -07:00
Nathan Shively-Sanders
f615e229d3 Fix default property assigned prototype (#40836)
* Fix default-property-assignment decls+prototype property decls

The check in getAssignedClassSymbol forgot to allow for default-property
assignment declarations, in part because it wasn't using a utility
function to do so.

* small cleanup

* make allowDeclaration parameter required
2020-09-30 08:36:52 -07:00
Alex T
df33dd593f fix(40441): show deprecated error for deprecated property in namespace (#40605) 2020-09-30 08:26:35 -07:00
Wesley Wigham
2428ade1a9 Match suffix _after_ prefix when inferring literals out of templates (#40841) 2020-09-29 16:34:58 -07:00
Sidharth Vinod
7c0f0d2c69 Update type diagnostic messages with --save-dev (#40776) (#40784)
* Update type diagnostic messages with --save-dev (#40776)

* Fix Baselines
2020-09-28 23:47:16 -07:00
Andrew Branch
3e824f18a8 Don’t offer non-relative non-paths path when baseUrl is undefined (#40813) 2020-09-28 12:06:39 -07:00
Andrew Casey
9f5310fd8d Use the existing checkCrossProductUnion helper 2020-09-25 13:37:54 -07:00
Andrew Branch
dc8952d308 jsx option affects emit (#40775) 2020-09-25 12:20:29 -07:00
Andrew Casey
6650496e85 Enforce a size limit in getSpreadType
When a union is spread into a union, the sizes are multiplied,
potentially resulting in an enormous union (especially if there are
repeated spreads).  This check detects cases that used to run out of
memory.

Fixes #40754
2020-09-24 14:52:42 -07:00
Nathan Shively-Sanders
eac75f375d CommonJS imports support destructuring+property access (#40702)
* CommonJS imports support destructuring+property access

Fixes #40578 for prettier

* will I ever remember semicolons? haha no

* move code around

* move function declaration closer to use

* Add missing space after `if`

Thanks to @weswigham for noticing this. Somehow it passed the linter.
2020-09-24 14:42:59 -07:00
Septs
e6fdcce2bf feat: expose findAncestor. (#40325)
* feat: add closest node util

* chore: add definition to baseline file

* chore: alias findAncestor to getClosestNode

* move findAncestor to public

* move findAncestor to public
2020-09-24 14:02:56 -07:00
Wenlu Wang
fc03982b73 Add missing visitor of template literal type (#40738)
* Add missing visitor of template literal type

* make linter happy
2020-09-24 12:48:29 -07:00
Wesley Wigham
a960463cf3 Allow pattern literal types like http://${string} to exist and be reasoned about (#40598)
* Allow pattern literal types like `http://${string}` to exist and be reasoned about

* Allow bigint, number, null, and undefined in template holes

* Add test of the trivia case

* Handle `any` in template holes, add assignability rules for template -> template relations

* Explicitly test concatenated patterns

* PR Feedback
2020-09-23 01:08:58 -07:00
Wesley Wigham
a91c2879ef Allow discrimination to identical object types when discriminating contextual types (#40574)
* Merge identical object types when discriminating contextual types

Co-authored-by: Orta <ortam@microsoft.com>

* Allow identical discriminants when discriminating, rather than trying to unify identical union members

* Fix lint

Co-authored-by: Orta <ortam@microsoft.com>
2020-09-23 00:51:14 -07:00
Wesley Wigham
ad2a07440c Fix crash on js declaration emit of export assigned default augmented function (#40596)
* Fix crash on js declaration emit of export assigned default augmented function

* {sp}
2020-09-23 00:50:12 -07:00
uhyo
61910e8c97 Fix missing constraints for parenthesized infer T (#40406)
* add tests

* consider parenthesized types in getInferredTypeParameterConstraint

* update tests
2020-09-23 00:48:40 -07:00
Wesley Wigham
10b240cde3 Allow an infer type node to resolve its own name (#40483) 2020-09-22 21:21:13 -07:00
Anders Hejlsberg
5d6cce5ca7 Const contexts for template literals (#40707)
* Support const assertions with template literal expressions

* Add tests

* Accept new baselines
2020-09-22 13:11:17 -10:00
Alex T
587252cbe9 feat(40674): make error messages more consistent (#40675) 2020-09-21 13:22:15 -07:00
Alex T
0310b530d8 feat(40663/40664): improve error messages for assignment assertions '!' (#40669) 2020-09-21 11:20:01 -07:00