Commit Graph
100 Commits
Author SHA1 Message Date
Wesley Wigham d53630fac3 Make specifier generation from export map information conditional on module resolution mode (#46670) 2021-11-03 13:10:44 -07:00
Wesley WighamandAndrew Branch de23842e45 Allow import assertions on esm imports under module: nodenext (#46630)
* Allow import assertions on esm imports under module: nodenext

* Changes to copy

Co-authored-by: Andrew Branch <andrew@wheream.io>
2021-11-02 15:34:37 -07:00
Wesley Wigham 28e3cd3a80 Add error on new module/moduleResolution modes when used in non-nightly TS (#46557)
* Add error on new module/moduleResolution modes when used in non-nightly TS

* Update diagnostic
2021-10-29 11:46:19 -07:00
Wesley Wigham abfd537503 Support resolveJsonModule in new module modes (#46434)
* Support resolveJsonModule in new module modes

* Formatting feedback
2021-10-27 12:30:06 -07:00
Wesley Wigham 2c7b13b830 Fix explainFiles on files under nodenext with types references (#46367)
* Fix explainFiles on files under nodenext with types references

* Fix explainFiles crash on module nodenext
2021-10-14 17:00:55 -07:00
Wesley Wigham 1c5d4e1740 Pass symbol under inspection into checkIndexConstraints (#46350) 2021-10-13 17:04:33 -07:00
Wesley Wigham ac345849e3 Set impliedNodeFormat on sourceFiles maufactured in watch mode (#46349) 2021-10-13 17:04:13 -07:00
Wesley Wigham 713afe2227 Set import mode on synthetic imports (#46327) 2021-10-12 16:23:37 -07:00
Wesley Wigham 82822fc1e9 Use a binary search when looking for the token at a given position (#46250) 2021-10-07 15:06:18 -07:00
Wesley Wigham 7108646713 Fix extension automatic script kind detection for new extensions (#46205)
* Fix extension script kind detection for new extensions

* Accept (correct) changes to existing baselines affected by correct ScriptKind detection
2021-10-06 13:23:54 -07:00
Wesley Wigham ed9c522fd6 Accept new moduleResolution options on commandline (#46239) 2021-10-06 13:17:27 -07:00
Wesley Wigham 1cee9731d2 Properly support scoped package self name lookups (#46212) 2021-10-05 12:41:44 -07:00
Wesley Wigham 47cd4d3ecf Only set package data map under watch mode (#46211) 2021-10-05 11:13:26 -07:00
Wesley Wigham a0cf126513 Limit package.json realpath lookup to only successful resolutions (#46209) 2021-10-05 10:24:08 -07:00
Wesley Wigham a02a7ab8e9 Follow and respect export maps when generating module specifiers (#46159)
* Follow and respect export maps when generating module specifiers

* Type baseline updates from master merge
2021-10-01 13:54:07 -07:00
Wesley Wigham ccc19092ff Modify synthetic default generation code for dual-mode module resolution (#46156) 2021-10-01 09:18:44 -07:00
Wesley WighamandAndrew Branch 612c92d603 Track source and target relationship stack depth seperately, only increase on change in value (#41821)
* Track source and target relationship stack depth seperately, only increase on change in value

* Add baselines for test from #43485

* Bail on unwrapping conditional constraints on the source side when the source conditional is already known to be spooling out of control

* More usage of isDeeplyNestedType to block _specifically_ conditional recursion on only one side

* Negative cases of getNarrowedType that match the exact type should be filtered out, even when generic

* Add test and fix for #44404

* Swap to manually specifying left and right recursion

* Rename Left -> Source, Right -> Target

Co-authored-by: Andrew Branch <andrew@wheream.io>
2021-09-30 16:58:40 -07:00
Wesley Wigham 8d5c197f99 keyof should always include remapped keys (#45923)
* Loosen check in getIndexTypeForMappedType to directly map property names when any indexy type is present

* Handle homomorphic mappings better in keyof, add specific relationship rule for relating generic keyof MappedType to handle remapped keys

* Remove trailing whitespace
2021-09-27 19:10:02 -07:00
Wesley Wigham 586b0d5011 moduleResolution: node12 support (#45884)
* Initial support for module: node12

* Add allowJs and declaration emit enabled tests

* Fix typos

* cts, mts, cjs, mjs, etc extension support

* Fix watch of files whose intepretation changes due to a package.json update

* Minor PR feedback

* Adjust error message

* Initial import/export/self-name support

* Accept new error codes

* TypesVersions support in export/import map conditions

* Fix import suggestion and autoimport default extensions under new resolution modes

* Add tests for import maps non-relative name lookup feature

* Fix isDeclarationFileName for .d.mts and .d.cts

* Preserve new extensions when generating module specifiers

* Fix spurious implict any suggestion caused by file ordering bug and optimize import name format detection by relying on parents being set

* Fix a bunch of incremental bugs that dont repro under fourslash for some reason

* Accept updated baseline

* Always include extensions on completions for cjs/mjs style imports

* String completion relative import suggestions respect the mode of the import when choosing if they provide extensions

* Style feedback

* Change diagnostic case
2021-09-24 14:25:59 -07:00
Wesley Wigham f598076e68 Close package json watches in watch mode on close (#45642) 2021-08-30 12:53:26 -07:00
Wesley Wigham 68eb1a551f Use getFileAndProject in session provideInlayHints to ensure language service updates are applied (#45394) 2021-08-10 11:48:35 -07:00
Wesley Wigham 7669bfba15 Actually instantiate the type of the annotation used for contextual types (#45285) 2021-08-02 12:44:56 -07:00
Wesley Wigham d0efe9065e Dont swallow declaration emit errors when issued on nodes without names (#44995) 2021-07-16 10:30:22 -07:00
Wesley Wigham 8268f2adec Avoid bogus circularity error on context sensitive constructor property assignments (#44601)
* Avoid bogus circularity error on context sensitive constructor property assignments

* Add JS case and ensure its fixed
2021-07-15 17:06:56 -07:00
Wesley Wigham 8e855d140b Watch mode watches for changes in package.json files used in resolution (#44935)
* watch mode watches for changes in package.json files used in resolution

* Pathify result of realpath

* Actually accept pathified baselines
2021-07-12 17:23:08 -07:00
Wesley Wigham 130e16d73b Add missing JSXSpreadAttribute case to JSX completion logic (#44514) 2021-06-10 10:01:25 -07:00
Wesley Wigham 09a21ce7c6 Consider inferences between mapped type templates lower priority (#44126) 2021-05-28 21:07:39 -07:00
Wesley Wigham 7c31d97cbf Move string trim methods from utilities to core (#44308) 2021-05-27 14:20:23 -07:00
Wesley WighamandDavid Michon fcabb5c0cc Simplify or optimize regexes with polynomial time worst cases (#44197)
* Simplify or optimize regexes with polynomial time worst cases

* PR feedback & cleanup

Co-authored-by: David Michon <dmichon-msft@users.noreply.github.com>

* Use builtin scanner function for checking whitespace in fallback method (its faster)

Co-authored-by: David Michon <dmichon-msft@users.noreply.github.com>
2021-05-24 15:28:52 -07:00
Wesley Wigham 2203228b62 Ensure static index signatures have an errorNode available (#44129)
* Ensure static index signatures have an errorNode available

* Lookup static index signature declarations in the right symbol table, stop checking prototype props
2021-05-24 14:30:59 -07:00
Wesley Wigham f414d13679 Dont allow generic narrowing when contextually typed by a binding pattern (#44081) 2021-05-13 16:51:52 -07:00
Wesley Wigham f7a97b7759 Cache accessibe symbol chains and serialized type parameter name generation (#43973)
* Cache accessibe symbol chains, type parameter name generation

* Move signature declaration helper length approximation to start of function

* Add node result caching internal to `typeToTypeNodeHelper`

* Suggestion from PR
2021-05-12 12:11:20 -07:00
Wesley Wigham a5607a4eab Dont allow namespace reexport symbols when looking up valid local names (#43969) 2021-05-06 12:03:48 -07:00
Wesley Wigham 456806b070 Allow filterType to consider union constraints of non-union types when determining never-ness (#43763)
* Allow filterType to consider union constraints of non-union types when determining never-ness

* Move impl to callback

* Baseline change in narrowing behavior into test, fix post-LKG build
2021-05-05 13:35:09 -07:00
Wesley Wigham b83148fe64 Unwrap substitutions on conditional check types before comparing them (#43888) 2021-05-05 13:33:45 -07:00
Wesley Wigham 84da19efc8 Add single-element fastpath to getSupertypeOrUnion (#43934) 2021-05-05 13:32:23 -07:00
Wesley Wigham 7748694d60 Relate non-augmenting subtypes without resorting to structural comparison (#43624)
* Relate non-augmenting array subtypes without resorting to structural comparison

* Fix lint

* Generalize performance enhancement

* Cache results, feed through via getNormalizedType to remove error intermediates

* Use newly freed up object flags to limit member setting, fix crash with those object flags

* Move flags because there is no TypeFlags.Reference 🤦
2021-04-27 22:52:12 -07:00
Wesley Wigham 5e4fcfbfb6 Add instantiation rules for reverse mapped types (#42449)
* Add instantiation rules for reverse mapped types

* Add smaller example of same issue
2021-04-27 15:01:46 -07:00
Wesley Wigham bbad560912 Refrain from attempting to perform parameter fixing on a generic signature multiple times (#43835)
* Refrain from attempting to perform parameter fixing on a generic signature multiple times

* Remove assertion
2021-04-27 10:49:27 -07:00
Wesley Wigham dee4903f45 Compute dervied generic-ness for substitutions and create lower priority inferences for substitutes (#43765) 2021-04-23 15:51:05 -07:00
Wesley Wigham 8ea4ec9496 Add infer T constraint inference rule matching up mapped type templates across check/extends types (#43649) 2021-04-21 12:49:02 -07:00
Wesley Wigham 167ebcd93b Check type flags before checking multiple-meaning object flags (#43745) 2021-04-19 22:35:11 -07:00
Wesley Wigham 7e4400b9c3 Stop checking getter/setter compatability twice (#43741)
* Stop checking getter/setter compatability twice

* Ensure modifier errors are still emitted on both accessors, accept modified baselines
2021-04-19 15:53:48 -07:00
Wesley Wigham 85c9d2cc89 Use faster, stricter prop type comparison when merging props in union prop creation (#43696)
* Use faster, stricter prop type comparison when merging props in union prop creation

* Be better at determining this usage in methods, accept baselines

* Small style change
2021-04-19 15:25:12 -07:00
Wesley Wigham 0eee64f0eb Node factory should insert override modifier between static and astnc (#43699) 2021-04-15 17:16:19 -07:00
Wesley Wigham 3ab6809e38 Consider identical instances of the same symbol equivalent when creating union and intersection properties (#43560)
* Consider identical instances of the same symbol equivalent when creating union and intersection properties

* Also copy over mapper and type (if available) on cloned symbols

* Editorial feedback
2021-04-14 16:55:45 -07:00
Wesley Wigham 6c7c5e9ec2 Expand exception to contravariant constraint elision to all type variables (#43599)
* Expand exception to contravariant constraint elision to all type variables

* Comment update
2021-04-14 13:13:02 -07:00
Wesley Wigham 6002cff776 Trim indexed access and type variable constraint error output (#43540) 2021-04-13 13:13:32 -07:00
Wesley Wigham cf8798d977 Make origin union cache key unique for key lists still under construction (#43339) 2021-04-05 11:47:49 -07:00
Wesley Wigham d1b43429c2 Allow nested reverse mapped type printback (#42485)
* Optimize interning of reverse mapped types

* Style feedback

* Whitespace

* Update baseline
2021-04-05 11:37:51 -07:00
Wesley Wigham 1f1dcd60b5 When reusing input type nodes, only instantiate the type for comparison if it is a this type (#42584) 2021-04-05 11:10:47 -07:00
Wesley Wigham f03e59ecc9 Do not covariantly mix in constraints from contravarrying positions (#43439)
* Do not covariantly mix in constraints from contravarrying positions

* Exclude keyof from constraint variance tracking

* Extra test case

* Always subtitute on type parameter types
2021-04-05 11:05:33 -07:00
Wesley Wigham fb60c9f46e Use last detected JSX import source pragma as canonical source, rather than first (#43351) 2021-03-23 18:02:37 -07:00
Wesley Wigham 9a256a1935 Adjust scanning of keywordy jsx namespace names, add grammar error for jsx dotted names containing namespace names (#43104) 2021-03-22 10:28:43 -07:00
Wesley WighamandNathan Shively-Sanders 2643e65da4 Add missing relationship allowing a type to be assignable to a conditional when assignable to both branches (#30639)
* Finally add that missing relationship allowing a type to be assignable to both branches of a conditional

* Explicitly write out Ternary.Maybe

* Add slightly modified example from #25413

* fix sick sentence

* Loosen check to skip false branch constraint check to consider `infer` parameters as always satisfied in the extends clause

* Simplify things a bit, only instantiate once

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2021-03-11 11:56:55 -08:00
Wesley Wigham 576bfbd9d5 Use yarn resolutions to inject nightly TS version across whole workspace in fabric test (#42961) 2021-02-25 11:12:09 -08:00
Wesley Wigham 3b35522fd0 Type lookup in getIntrinsicAttributestypeFromJsxOpeningLikeElement should match getIntrinsicTagSymbol (#42819) 2021-02-24 22:36:04 -08:00
Wesley Wigham 8d58c8d90b Base signatures resolve only the type parameters local to the signature, not all type parameters (#42703) 2021-02-23 16:17:57 -08:00
Wesley Wigham 6da262591c Bail when comparing a specialized form of an already ongoing comparison (#42727)
* When structurally comparing similar types, check if we are already in the middle of a more general comparison of those same types

* Do the same, but with only string manipulations
2021-02-23 16:13:59 -08:00
Wesley Wigham 87d10eb055 Eliminate well known symbols as a concept in the checker and rely on unique symbols (#42543)
* Eliminate well-known symbols in the checker: 2021 edition

* Actually update the lib text to say unique symbol, too (this is unneeded with compat code in place, but this makes goto-def make more sense)

* Add test showing mismatched symbol constructor type interop

* Add more test cases for some other related issues this fixes

* Revert computed name change

* Style comments
2021-02-22 14:43:28 -08:00
Wesley Wigham 5a1d30815b Combine multiple overloads into a single contextual signature (#42620)
* When noImplicitAny is set, combine multiple contextual overloads into a single signature, rather than producing `any` and an error

* Amalgamate intersection composite signature return types as intersections, rather than the prior exclusively union behavior

* Add another example from an issue, albeit slightly modified

* Fix newlines, add test from DT

* Interior remodelling
2021-02-22 13:34:47 -08:00
Wesley Wigham 4c43e09c9e Add fallback error locations for nameless declarations, better class error locations (#42585) 2021-02-05 12:07:14 -08:00
Wesley Wigham 19db9ad675 Swapping the quote style of a string for completions should swap _all_ quotes in the string (#42650) 2021-02-04 13:56:34 -08:00
Wesley Wigham f569aa3832 Use a (hopefully) more efficient regex for matching jquery in the safelist (#42653) 2021-02-04 13:53:05 -08:00
Wesley Wigham 62bc8bec4e Replace _all_ tabs in pretty output, not just the first on each line (#42649) 2021-02-04 13:25:53 -08:00
Wesley Wigham be18057792 Add check for no match into fs watch rename event handler (#42651) 2021-02-04 13:20:38 -08:00
Wesley Wigham 2730cb24f5 Only skip any checks for unwrapped tuples in conditionals, rather than all nondistributive conditionals for backcompat (#42447) 2021-01-28 23:36:43 -08:00
Wesley Wigham 5a21291b7c Propegate contextual types through nonnull assertion operators (#42526) 2021-01-28 09:24:54 -08:00
Wesley Wigham 517f32940a Add regression test for #37314 (#42525) 2021-01-27 15:30:59 -08:00
Wesley Wigham 203a5ce78f Include all properties from the mapped modifier type when calculating index types for mapped types with name types (#41976) 2021-01-27 13:32:46 -08:00
Wesley Wigham d7d8f33def In bundle declaration emit, refuse to rewrite nonrelative references to files outside the common source directory (#42306) 2021-01-25 11:16:59 -08:00
Wesley Wigham 71d4ee5d60 Preserve alias information where possible when looking up union and intersection base constraints (#42430) 2021-01-21 13:06:56 -08:00
Wesley Wigham 0d494abc77 Add missing unwrap call for the inferredExtendsType (#42409) 2021-01-19 18:02:35 -08:00
Wesley Wigham 621e0afe00 Accept merge-conflicted baseline (#42398) 2021-01-18 07:05:11 -08:00
Wesley Wigham ab32fcadbd Fix type parameter lookup for TypeAlias LibraryManagedAttributes (#42245) 2021-01-15 17:23:01 -08:00
Wesley Wigham c3dd845923 Better detect when typical nondistributive conditionals need to be defered by unwrapping their check and extends types (#42248) 2021-01-12 12:59:52 -08:00
Wesley Wigham 11606e4de4 Do for unions of many empty-object-spreadables what we did for unions of 2 (#42233)
* Do for unions of many empty-object-spreadables what we did for unions of 2

* Accept baseline
2021-01-07 12:05:40 -08:00
Wesley Wigham 72dfc589a1 Retain CheckFlags.Late on symbols manufactured based on Late-bound symbols (#42205) 2021-01-04 15:49:52 -08:00
Wesley Wigham c3ff0d4c17 Under jsx: preserve, actually preserve expressions which contain only comments (#41757)
* Under jsx: preserve, actually preserve expressions which contain only comments

* Even better best effort comment preservation in JSX comments
2020-12-18 11:42:33 -08:00
Wesley Wigham caebbe6714 Dont check computed name visibility results when the computed name representation is not in use (#41806) 2020-12-18 11:41:55 -08:00
Wesley Wigham 052d7308e6 Add type annotation into services so _services_ API baseline is stable post-LKG (#42028) 2020-12-17 18:09:42 -08:00
Wesley Wigham 3722584029 Make the configurePrerelease script OK with version having a string type annotation (#42008) 2020-12-17 10:13:12 -08:00
Wesley Wigham b217f22e79 Allow identical type parameter lists to merge in union signatures (#31023)
* Have signature identity checks look at the base constraint of type parameters, allow identical type parameter lists to merge in union signatures

* Update text in fourslash test

* Add whitespace to fix lint, remove duplicate impl

* Consolidate names

* Remove comparisons of type parameter defaults, add more test cases
2020-12-16 13:17:57 -08:00
Wesley Wigham 675cd4d7ce Ensure factory symbol remains unused in react-jsx mode when not referenced in user code (#41905) 2020-12-16 13:11:48 -08:00
Wesley Wigham 4b8b0c861e Fix post-LKG API baselines (#41973) 2020-12-16 11:31:39 -08:00
Wesley WighamandDaniel Rosenwasser b869c9cffa Add text-based fastpaths into LS token matching (#41924)
* Add text-based fastpaths into LS token matching

* Update src/services/utilities.ts

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>

* Update src/services/utilities.ts

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>

* Update src/services/utilities.ts

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>

* Limit search a bit

* Secretly, this was allowed to be `undefined` and was in fact used as such

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
2020-12-15 15:40:48 -08:00
Wesley Wigham b9f372ed00 Generalize the fastpath for comparisons of unions which are correspondences (#41903)
* Generalize the fastpath for comparisons of unions which are correspondences to unions resulting from the application of intersections

* Add comment
2020-12-15 13:57:23 -08:00
Wesley Wigham 6bcb6bb369 Simplify expression type to fix build break (#41942) 2020-12-12 13:51:10 -08:00
Wesley Wigham 69143ecc5b Reuse input nodes where possible when serializing jsdoc implements clauses (#41783)
* Reuse input nodes where possible when serializing jsdoc implements clauses

* Whitespace changes, per PR feedback
2020-12-08 12:13:37 -08:00
Wesley Wigham 360958e04c JSDoc declaration emit should reuse input nodes where possible when serializing typedefs (#41760)
* JSDoc declaration emit should reuse input nodes where possible when serializing typedefs

* Style comments
2020-12-04 13:42:35 -08:00
Wesley Wigham 9f9eed400c Read the base construct signature from the static base type, not the instance base (#41767) 2020-12-02 13:30:46 -08:00
Wesley Wigham 0da5a7e4ba Add missing BinaryExpression source side cases to isMatchingReference (#41765) 2020-12-01 14:47:14 -08:00
Wesley Wigham 2a3f5508ec addImplementationSuccessElaboration admits declarations with no symbol (#41758) 2020-12-01 12:19:12 -08:00
Wesley Wigham 573768aaf5 Merge pull request #41506 from weswigham/fix-post-LK-build
Fix post-LKG build
2020-11-11 17:14:01 -08:00
Wesley Wigham bfea348e40 Actually install playwright in artifact build script
Now that it's not installed by default
2020-11-11 16:33:39 -08:00
Wesley Wigham a5606ec5e9 Merge pull request #41467 from weswigham/fix-incremental-jsx-crash
Fix crash on attempting to suggest a ts import for a synthetic js resolution
2020-11-11 13:20:17 -08:00
Wesley WighamandDaniel Rosenwasser 816af71d58 Fix incremental emit issue where dependency relations implied by synthesized imports would not be detected (#41346)
* Fix incremental emit issue where dependency relations implies by synthesized imports would not be detected

* Update src/compiler/program.ts

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
2020-11-01 16:05:49 -08:00
Wesley Wigham 479105090d Merge pull request #41330 from weswigham/jsx-import-source-as-auto-import
Auto-include types for the jsx import source in the new jsx transforms
2020-10-30 16:51:04 -07:00
Wesley Wigham e044b56d7f Merge pull request #40985 from weswigham/static-decl-ref
Adjust typeof import name lookup to better match type query lookup
2020-10-30 11:13:23 -07:00
Wesley Wigham f0f3862cd9 Merge pull request #41314 from weswigham/fix-global-jsx-ns-alias-crashes
Fix crashes when the global JSX namespace is an alias
2020-10-28 18:38:26 -07:00