10561 Commits

Author SHA1 Message Date
Joost Koehoorn
3c736255e4
Properly cache types for shared control flow nodes (#41665) (#41906)
* Properly cache shared flow node types

* Add test

Co-authored-by: Anders Hejlsberg <andersh@microsoft.com>
2020-12-09 18:33:51 -08:00
TypeScript Bot
1e9518cb35
Cherry-pick PR #41758 into release-4.1 (#41862)
Component commits:
0d61b143cb addImplementationSuccessElaboration admits declarations with no symbol

Co-authored-by: Wesley Wigham <t-weswig@microsoft.com>
2020-12-09 13:50:27 -08:00
Orta Therox
abf88154d2
Undo #39258 (isArray changes) see overview at #41808 (#41849) 2020-12-07 21:59:10 +00:00
Andrew Branch
9b6625895b
Add missed resolveSymbol in commonjs import resolution (#41479) (#41691)
Fixes resolution of export aliases in the postfix-property-access case
of commonjs require:

```js
const { x } = require('./foo').nested
x
```

This program would previously fail if `x` was an export alias.

Fixes #41422

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2020-12-02 14:54:10 -08:00
Wesley Wigham
ca766df7e4
Fix/jsx global preferred over config implicit (#41476) (#41583)
* Add actual baselines for a problem with global namespace being preferred over config & pragma implicit ones

* Fixed an issue with global React namespace being preferred over config & pragma implicit ones

* Do not try to mark JSX classic runtime symbols as used when automatic runtime is used

Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com>
2020-11-18 15:57:32 -08:00
Orta Therox
c12cc533b2
Remove bundledPackageName from release 4.1 (#41536)
* Merge release 4-1

* Remove unused tests
2020-11-14 21:39:08 -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
Ron Buckton
f944afd053 Fix double alias of complex export/import/default/namespace combination 2020-10-29 18:42:36 -07:00
Ron Buckton
bcbe1d7638
Merge pull request #41094 from microsoft/destructuringEvaluationOrder
Fix destructuring evaluation order for initializers
2020-10-29 17:12:18 -07:00
Oleksandr T
eb6ddf6b29
fix(40671): suggest ConvertStringToTemplateLiteral refactoring for string with property/element acceses elements (#40942) 2020-10-29 15:23:11 -07:00
Wesley Wigham
6714998e01
Auto-include types for the jsx import source in the new jsx transforms 2020-10-29 14:17:24 -07:00
Ron Buckton
2b7e790732 Update control flow for nested binary exprs 2020-10-29 13:32:32 -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
Ron Buckton
8a15291541 Update control flow for correct destructuring evaluation order 2020-10-28 16:50:15 -07:00
Wesley Wigham
d722392d81
Fix crashes when the global JSX namespace is an alias 2020-10-28 14:31:40 -07:00
Wesley Wigham
4ec02a56b8
Bind comma expression LHS call expressions 2020-10-28 13:48:29 -07:00
Wesley Wigham
ca8a15d37b
Merge pull request #41287 from weswigham/bind-exports-assigned-object-as-alias
Bind `module.export = {Thing}` with alias symbols
2020-10-28 13:14:20 -07:00
Anders Hejlsberg
bd27bd8d47
Don't relate unmatched parameter positions in signatures (#41308)
* Don't relate unmatched parameter positions in signatures

* Add regression test

* Accept new baselines
2020-10-28 11:55:32 -07:00
Sheetal Nandi
e17d95dada
When creating synthetic default symbol set parent as module symbol (#41282)
Fixes #40684
2020-10-28 11:24:40 -07:00
Wesley Wigham
6acce0ca6f
Merge pull request #41075 from uhyo/fix-36958
allow type narrowing with NonNullExpression
2020-10-27 20:10:27 -07:00
Oleksandr T
af38ab90e2
feat(41249): allow import.meta with module: es2020 (#41274) 2020-10-27 17:26:15 -07:00
Wesley Wigham
e96ce39b60
Fixup other fourslash test 2020-10-27 16:25:30 -07:00
Anders Hejlsberg
40b81224f9
Remove string literals from unions with matching template literals (#41276)
* Remove string literals from unions with matching template literals

* Add tests

* Accept new baselines
2020-10-27 16:21:07 -07:00
Wesley Wigham
d1bc6b1ba6
Bind module.export = {Thing} with alias symbols 2020-10-27 15:43:00 -07:00
Michael
71cd5d522d
Fix two issues with ConvertToTypeOnlyExport codefix (#40490)
* Modify test case to reproduce error

* Fix TypeOnlyExport codefix to work with 3 or more type exports in the same declaration

The check to ensure that a fixed export declaration wasn't fixed again
was reversed. This only surfaced when 3 or more type exports existed in
the same declaration.

* Add failing test cases for comments being duplicated

* Fix convertToTypeOnlyExport codefix from duplicating leading comments

* Simplify convertToTypeOnlyExport when change is just inserting `type` keyword

Co-authored-by: Andrew Branch <andrew@wheream.io>
2020-10-27 15:08:20 -07:00
Oleksandr T
9ed608b439
fix(41244): ignore synthesized imports (#41267) 2020-10-27 13:22:02 -07:00
Wesley Wigham
c923023494
Merge pull request #41191 from weswigham/control-flow-comma-exprs
Track control flow for comma expressions in call expressions
2020-10-27 12:37:02 -07:00
Anders Hejlsberg
f9dcd9ef98
Don't cache Ternary.Maybe results when recursion is encountered during variance measurement (#41218)
* Don't record Ternary.Maybe results in cache during recursive variance measurement

* Add regression test

* Accept new baselines

* Use Ternary.Unknown to signal variance recursion

* Add comments

* Fix comment
2020-10-27 10:53:13 -07:00
Oleksandr T
3754bb4455
fix(40994): change type for optional properties (#41011) 2020-10-27 10:05:40 -07:00
Daniel Rosenwasser
3517af8f80
Make 'getIndentString' just use a loop. (#41221)
* Make 'getIndentString' just use a loop.

* Added test.

* Accepted baselines.
2020-10-26 12:19:31 -07:00
Wesley Wigham
94b0e0e389
Merge pull request #41190 from weswigham/handle-binding-element-aliases
Handle the new js binding element alias symbols in JS declaration emit
2020-10-23 10:31:08 -07:00
Ron Buckton
0b303ff08a Fix some rest cases and handling of unused results 2020-10-22 18:58:21 -07:00
Ron Buckton
28c4f32ddf Merge branch 'master' into destructuringEvaluationOrder 2020-10-22 17:14:23 -07:00
Anders Hejlsberg
d1f87d18b1
Support partial reverse mapped inferences with tuple types (#41106)
* Support partial reverse mapped inferences with tuple types

* Add tests

* Accept new baselines
2020-10-22 11:27:41 -07:00
Wesley Wigham
6dde1621cb
Track control flow for comma expressions in call expressions 2020-10-21 12:31:29 -07:00
Anders Hejlsberg
5d021b401a
Don't reduce 'keyof M' for mapped types with non-distributive 'as' clauses (#41186)
* Don't reduce 'keyof M' for mapped types with non-distributive as clauses

* Add regression test

* Accept new baselines
2020-10-21 12:16:46 -07:00
Wesley Wigham
f4255dd237
Handle the new js binding element alias symbols in JS declaration emit 2020-10-21 11:24:19 -07:00
Andrew Branch
1f852ed747
Percent-encode source map URLs (#41102) 2020-10-20 13:11:52 -07:00
Wesley Wigham
0ad22de146
Merge branch 'master' into fix/create-element-new-jsx-transform 2020-10-19 15:21:52 -07:00
Wesley Wigham
aa9445bc15
Merge branch 'master' into empty-jsx-child 2020-10-19 14:54:20 -07:00
Wesley Wigham
b8dfa28ca8
Do not consider empty jsx expressions semantically important children 2020-10-19 13:34:16 -07:00
Anders Hejlsberg
4638c685b1
Properly reduce intersections of string literal and template literal types (#41162)
* Properly reduce single element intersections

* Add regression test

* Accept new baselines
2020-10-19 13:05:29 -07:00
Anders Hejlsberg
3918e6c535
Move anonymous type instantiation cache from AST node to root type (#41084)
* Move anonymous type instantiation cache from AST node to root type

* Use "root" type reference as cache location for deferred type references

* Add test

Co-authored-by: Andrew Branch <andrew@wheream.io>
2020-10-19 07:26:48 -07:00
Mateusz Burzyński
43433eb2f1 Add tests related to the key prop when using new JSX transform 2020-10-17 15:20:39 +02:00
Wesley Wigham
ce1947b0be
Merge pull request #41070 from weswigham/use-minimal-endings-in-bundled-declaration-emit
Use minimal endings when generating declarations for js
2020-10-14 15:29:50 -07:00
Eli Barzilay
5b2fba3334 transformGenerators: handle CommaListExpression
Uses essentially the same code as `visitCommaExpression` (which was
moved, to keep both together and close to
`visit{Right,Left}AssociativeBinaryExpression`).

Fixes #40614.
2020-10-14 15:58:13 -04:00
Ron Buckton
7393dba6bd Fix destructuring evaluation order for initializers 2020-10-13 17:14:35 -07:00
Wesley Wigham
84726be01a
Merge pull request #40597 from weswigham/allow-instanceof-array-to-narrow-readonly-array
Handle the mapping between Array and ReadonlyArray in isTypeDerivedFrom
2020-10-13 15:08:17 -07:00
Alex T
417b8a9481
fix(29881): infer quote preference for property access conversion in completions (#41041) 2020-10-13 10:06:27 -07:00