Commit graph

27294 commits

Author SHA1 Message Date
Andrew Branch
96660f6c00
Just look at the current node instead of context 2019-04-02 11:31:05 -07:00
Andrew Branch
96990800e3
Add new baselines 2019-04-02 11:17:22 -07:00
Andrew Branch
d198c5906f
Be stricter while parsing arrow function heads in conditional expressions 2019-04-02 11:17:21 -07:00
Anders Hejlsberg
d61a6935d3 More exploration of indexed access type constraints in type relations 2019-04-02 10:02:09 -07:00
TypeScript Bot
0830292633 Update user baselines (#30703) 2019-04-02 09:38:52 -07:00
Andrew Branch
abd448fe62
Remove unused arguments 2019-04-01 14:14:19 -07:00
Andrew Branch
f383c3c42d
Add test for parenthesized variable and function keyword within ternary 2019-04-01 14:11:30 -07:00
Andrew Branch
ae391497b0
Add new baselines for destructuring void 2019-04-01 13:36:07 -07:00
Andrew Branch
b4ec2e4f50
Handle destructuring zero elements from void 2019-04-01 13:34:27 -07:00
Andrew Branch
9a3149b967
Add failing tests for destructuring void 2019-04-01 13:33:41 -07:00
Anders Hejlsberg
3e09d29b95 Accept new baselines 2019-03-31 16:54:02 -07:00
Anders Hejlsberg
95c8a92b88 Add getIndexedAccessOrUndefined function 2019-03-31 16:52:50 -07:00
Anders Hejlsberg
5de3ee8ebc getIndexedAccessType for assignment target uses intersections 2019-03-30 10:13:13 -07:00
Sheetal Nandi
025d826339
Merge pull request #30513 from Microsoft/incrementalFromCommandLine
Allow --incremental from command line
2019-03-29 15:06:48 -07:00
Sheetal Nandi
cf8b308511 Add test for out file concat where command line --incremental flag changes between compilation 2019-03-29 14:42:02 -07:00
Anders Hejlsberg
fc95dc42f9 Improve soundness of indexed access type relations 2019-03-29 13:00:00 -07:00
Sheetal Nandi
17ceddaa1a
Merge pull request #29493 from Kingwl/avoid-quickfix-for-declaration-file
avoid add missing member in declaration file
2019-03-29 11:58:08 -07:00
Gabriela Araujo Britto
bb5eb025a8
Handle imports and exports in 'convert parameters to destructured object' (#30475)
* add test for imported function

* start to implement import references check

* fix imported function test

* skip alias when looking for symbol target

* recognize ES6 imports

* recognize some export syntax

* add tests for imports/exports

* add test for imported function

* start to implement import references check

* fix imported function test

* skip alias when looking for symbol target

* recognize ES6 imports

* recognize some export syntax

* add tests for imports/exports

* add test for imported function

* start to implement import references check

* fix imported function test

* recognize ES6 imports

* recognize some export syntax

* add mode import/export syntax cases

* fix entryToFunctionCall to deal with new calls through property/element access expressions

* add more tests for imports/exports

* allow function and class declarations that have no name but have a default modifier

* rename tests

* fix conflict

* fix tests

* add test for nameless class

* rename function

* minor refactor

* remove old tests

* delete old test

* refactor as suggested

* use getContainingFunctionDeclaration
2019-03-28 13:34:29 -07:00
Anders Hejlsberg
c03b7f525c
Merge pull request #30568 from Microsoft/instantiateContextualTypes
Contextual typing based on instantiated types
2019-03-28 12:38:01 -07:00
Daniel Rosenwasser
f6d70333f2
Merge pull request #30626 from Microsoft/discriminantFromIntersectionErrors
Better discriminant property errors on intersections
2019-03-28 14:15:14 -04:00
Daniel Rosenwasser
081637f2f8 Accepted baselines. 2019-03-27 23:42:20 -07:00
Daniel Rosenwasser
74d3e2a3ef Generalize to intersection types when looking for discriminants in error reporting. 2019-03-27 23:41:43 -07:00
Daniel Rosenwasser
69affb7f28 Accepted baselines. 2019-03-27 23:32:00 -07:00
Daniel Rosenwasser
6a244b9058 Added test. 2019-03-27 23:29:22 -07:00
Wesley Wigham
b7881a26a0 Unify substitution type any handling into costruction and instantiation (#30592)
* Unify substitution type `any` handling into costruction and instantiation

* Strengthen supertype reduction check to reduce breakage

* Rename conditional type fields per convention

* Explicitly handle anyish signatures in compareSignaturesRelated so strict variance doesnt kill subtyping

* Allow tuple expansions to an `any` rest to be considered an `any` signature as well
2019-03-27 12:55:17 -07:00
王文璐
9050d0fdf8 update external files api 2019-03-27 19:06:21 +08:00
王文璐
6bc5ef3474 Merge branch 'master' into avoid-quickfix-for-declaration-file 2019-03-27 18:36:56 +08:00
Sheetal Nandi
6deb9cdfc7 Add test for incremental with --tsbuildinfo file without specifying --out or config 2019-03-26 16:03:06 -07:00
Sheetal Nandi
a4091ae8e3 Merge branch 'master' into incrementalFromCommandLine 2019-03-26 14:57:18 -07:00
Sheetal Nandi
307bf39572
Merge pull request #30605 from Microsoft/sourceFileVersionTsc
Ensure that we are setting source file version with --incremental from tsc (without --build or --watch)
2019-03-26 14:53:13 -07:00
Sheetal Nandi
7457e5d9fe Pull out the incremental compilation into a function so we can test it 2019-03-26 14:28:05 -07:00
Sheetal Nandi
021444a248 Make it as api so we can test it 2019-03-26 14:25:56 -07:00
Sheetal Nandi
e28869d888 Ensure that from tsc with --incremental sets source file version
Fixes #30588 and #30589
2019-03-26 14:25:47 -07:00
Sheetal Nandi
684c531386 Always assert that source files are versioned when program is used with Builder 2019-03-26 11:55:12 -07:00
TypeScript Bot
72dc16a627 Update user baselines (#30595) 2019-03-26 07:31:19 -07:00
Anders Hejlsberg
fca46bb706 Compute per-element contextual type in getSpreadArgumentType 2019-03-26 07:00:19 -07:00
Sheetal Nandi
35470b3f3b Make tsbuildInfoFile as commandline option to tsc (and not tsc -b) 2019-03-25 14:47:36 -07:00
Nathan Shively-Sanders
32054f1c31
Forbid accessing block-scoped variables on globalThis (#30510)
* Forbid accessing const & let on globalThis

It's just an error; you still get the type of the property.

* Disallow access of blockscoped vars on globalThis

Also change Array, Function, String, et al from `const` to `var` so that
they remain accessible via `globalThis.String`.

* Update baselines after lib.d.ts change

Note especially the change in redefineArray, which is now allowed as
long as you provide a type that is assignable to ArrayConstructor.

* Remove blockscoped vars from typeof globalThis

Unlike forbidding them, this removes the properties entirely.

Unfortunately, this means that accessing these properties is only an
error with noImplicitAny, and that error is quite confusing.

Let's discuss our options. I see 3:

1. Forbid access of block-scoped vars as properties (in all flag
settings), but leave them on the type. Simple to implement.
2. Remove block-scoped vars from the globalThis type. Has the bad
error/flag behaviour described above, but simple to implement.
3. Remove block-scoped vars from the globalThis type. Also, forbid
accessing them by executing another resolveName lookup for failed
property accesses on globalThisSymbol. If the second lookup returns a
blockscoped var, issue an error instead of falling back to the index
signature. This seems too complex to me.

* Update baselines

* Better error for block-scoped usage on globalThis

So that value-space references have as clear an error as type-space
references.

* Update fourslash tests

* Fix semi-colon lint

* Don't copy so much when filtering blockscoped vars
2019-03-25 14:07:48 -07:00
Anders Hejlsberg
de76d55ddd Accept new baselines 2019-03-24 11:34:22 -07:00
Anders Hejlsberg
887b30682b Add tests 2019-03-24 11:34:14 -07:00
Anders Hejlsberg
6dc8b5f8fb Accept new baselines 2019-03-24 11:24:45 -07:00
Anders Hejlsberg
3d0e2f5f45 Introduce ContextFlags to propagate origin of request for contextual type 2019-03-24 11:15:51 -07:00
Anders Hejlsberg
7ec7f02ec3 Instantiate contextual type using non-fixing mapper 2019-03-23 10:46:46 -07:00
Wesley Wigham
e20b87f66d
Add script for posting perf results back to GH (#30526)
* Add script for posting perf results back to GH

* Slightly more logging, use html url, not api url, lol

* Log even more, nonzero exit code on error
2019-03-22 17:39:20 -07:00
Gabriela Araujo Britto
0f6f3b79b5
Fix find all references of inherited constructor (#30514)
* recursively look for inherited constructor references

* add test

* remove outdated comment

* add tests

* move function

* improve tests

* minor refactor

* fix convert params refactoring to deal with inherited constructor calls

* simplify refactor test
2019-03-22 15:17:50 -07:00
Wesley Wigham
1639a5a2c2
Handle huge unions better in createUnionOrIntersectionProperty (#30411)
* Handle huge unions better in createUnionOrIntersectionProperty

* Mimic first-in-wins behavior of pushIfUnique to retain order

* !props -> props.length === 0 (why dont we warn on that ffs)

* Avoid collection into an array if there are no properties
2019-03-22 09:56:39 -07:00
王文璐
e8b6615c2c update types 2019-03-22 18:13:18 +08:00
王文璐
35ded510bb Merge branch 'master' into attach_property_to_default_export 2019-03-22 17:40:37 +08:00
Wesley Wigham
b86dea03f2
Fix crash caused by cyclic defaults (#30532) 2019-03-21 18:27:14 -07:00
Sheetal Nandi
e72f006664
Merge pull request #30524 from Microsoft/moduleResolutionError
Report output file not built error for any module resolution that ends up to source file
2019-03-21 10:05:49 -07:00