Commit Graph
10476 Commits
Author SHA1 Message Date
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
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
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
Andrew Branch a301001420 Use correct program when checking for reexports from AutoImportProviderProject (#40843) 2020-09-30 09:32:19 -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
Armando Aguirre f645418833 Merge pull request #40783 from armanio123/FixCommentOnStartLine
Fixed bug with toggleLineComment ends in a start line
2020-09-29 11:43:51 -07:00
Alex T 1e9f42fb16 fix(40609): add tests to cover TemplateLiteralType extraction (#40834) 2020-09-29 11:29:51 -07:00
Alex T 335ed915f1 fix(40609): fix crash for extracting type alias with several type arguments (#40820) 2020-09-28 23:12:15 -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
Armando Aguirre 8cf980af8d Fixed bug with toggleLineComment ends in a start line 2020-09-25 19:00:02 -07:00
Alex T 73f5f02e97 fix(40756): disable truncation for inferred type (#40764) 2020-09-25 13:01:08 -07:00
Alex T 8e86b24036 feat(40233): add JS Doc types to smart selection (#40338) 2020-09-25 12:36:04 -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 03b70e6231 Remove old Typescript-*-Starter user tests (#40752)
This only removes the ones with repos that are now readonly; some repos
are still getting updates, so I left them in as tests.

Neither one fails right now, so there's no .log files to delete from the
baselines.
2020-09-24 13:47:41 -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 WighamandOrta 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
Alex T 78830f3be2 fix(40510): add element access expressions support in convertToOptionalChainExpression (#40524) 2020-09-22 18:17:17 -07:00
Andrew Branch 9eb6424b8f Fix indentation of arrow functions returning parenthesized expressions (#40677)
* Fix indentation of arrow functions returning parenthesized expressions

* Add more test cases
2020-09-22 17:16:09 -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 0310b530d8 feat(40663/40664): improve error messages for assignment assertions '!' (#40669) 2020-09-21 11:20:01 -07:00
Anders Hejlsberg fbce4f6c98 Intrinsic string types (#40580)
* Introduce Uppercase<T> and Lowercase<T> intrinsic types

* Accept new API baselines

* Add Uppercase/Lowercase/Capitalize/Uncapitalize to lib.d.ts

* Update fourslash

* Add an 'intrinsic' keyword

* Update template literal type tests

* Accept new API baselines

* Minor fixes

* Switch Capitalize<T> and Uncapitalize<T> to intrinsic types

* Add tests

* Accept new baselines

* Accept new baselines

* Remove template literal type casing modifiers

* Update tests

* Accept new baselines

* Add more tests

* Normalize nested template literal types

* Add normalization tests

* Accept new baselines

* Update tests
2020-09-21 07:09:29 -10:00
Anders Hejlsberg ce3dbef5f7 Support properties of mapped types in assertion control flow analysis (#40482)
* Support properties of mapped types in assertion control flow analysis

* Add regression test

* Accept new baselines
2020-09-21 07:07:29 -10:00
Anders Hejlsberg 17c7c261d4 Properly preserve modifiers in homomorphic mapped types with 'as' clauses (#40633)
* Use original property name to fetch source property for modifiers

* Add regression test

* Accept new baselines
2020-09-19 06:12:39 -10:00
Hikari Hayashi f1ac8cd93f Fix children prop for react-jsx and react-jsxdev (#40630)
* Fix children prop for `react-jsx` and `react-jsxdev`

* Add tests
2020-09-18 14:26:20 -07:00
Alex T 6c6ddfe5c0 fix(39899): include in NavigationBar default exported call expression arguments (#40412) 2020-09-18 13:06:56 -07:00
Andrew Branch 735a67a05e Fix iterable contextual type (#40592) 2020-09-17 10:42:47 -07:00
Alex T d779a19053 fix(40432): show as keyword in function context (#40481) 2020-09-17 02:15:48 -07:00
Wesley Wigham 98314d77e8 Use unexpanded parameter list in serialization when the expanded list has a non-trailing variadic position (#40556) 2020-09-14 19:56:24 -07:00
Ron Buckton dba042d7d5 Add quick fix to add 'void' to Promise resolved without value (#40558)
* Add codefix to add 'void' to Promise resolved without value

* Add specific error message in checker to reduce quick-fix time in editor
2020-09-14 19:12:33 -07:00
Andrew Branch 575baf5c7f Support auto-import from paths alias without baseUrl (#40546) 2020-09-14 15:23:47 -07:00
Nathan Shively-Sanders ec36d73e7a Fix error on duplicate commonjs exports (#40545)
* Fix error on duplicate commonjs exports

Previously, the code missed setting the parent pointer for the lhs
access expression.

Also add declaration emit of element access expressions, missed in my
previous PR.

* Switch to excludes=None, add test case

CommonJS exports have None excludes, but still have an error issued by
the checker. This is the previous behaviour even though it would be nice
to add some exclusions.
2020-09-14 13:12:51 -07:00
Alex T c493d077a3 copy prologue directives to new file (#40306) 2020-09-14 12:24:32 -07:00
Wesley Wigham 94123d5744 Issue a diagnostic when the node builder performs truncation despite the NoTruncation flag being set (#40477) 2020-09-14 12:20:57 -07:00
Anders Hejlsberg 57c8938d9e Consistent inferences when inferring to template literal type (#40518)
* Consistently make inferences when inferring to template literal type

* Add tests

* Accept new baselines
2020-09-12 16:33:33 -10:00
Nathan Shively-Sanders 9c99870058 Support element access aliases: exports["x"] = x (#40514) 2020-09-11 18:05:47 -07:00
Anders Hejlsberg eee799fe0c Properly check types in template literal placeholders (#40498)
* Properly check types in template literal placeholders

* Add regression test

* Update test

* Accept new baselines
2020-09-11 14:48:35 -10:00
Ryan Cavanaugh ea51fabb7c Don't crash when observing invalid 'export' in object literal (#40295)
Fixes #32870
2020-09-11 17:18:23 -07:00