2486 Commits

Author SHA1 Message Date
Ron Buckton
0bf0bf6f53 Minor cleanup and some related tests 2018-02-04 18:49:28 -08:00
Ron Buckton
c4d7e4806a Add Awaited<T> to core library 2018-02-03 20:51:43 -08:00
Wesley Wigham
89de4c9a3a
Only apply global augmentations before globals are available (#21563)
* Only apply global augmentations before globals are available

* Add detailed comment explaining the split of global/nonglobal augmentations

* Remove trailing whitespace
2018-02-02 18:44:54 -08:00
Nathan Shively-Sanders
be0fcd5174
Array.concat now takes ConcatArray, not ReadonlyArray (#21462)
* Overloads in Array.concat now handle ReadonlyArray

Previously it was union types, which is slower.

* Make arrayConcat3 test stricter

* Switch to InputArray instead of adding overloads

* Update baselines

* Update baselines correctly

* Rename to ConcatArray and add slice method

Should make it, respectively, easier to understand this specific type
and harder to satisfy it by mistake.
2018-02-02 13:20:40 -08:00
Wesley Wigham
2c3b69336f
Collect import helper needs during module info gathering (#21567)
* Collect import helper needs during module info gathering

* Add tests for other forms that trigger import helpers
2018-02-02 13:17:39 -08:00
Wesley Wigham
b3ec8cce00
Leverage existing function for choosing spread validity (#21564) 2018-02-02 10:11:50 -08:00
Wesley Wigham
8b81d19b6d
Enable CFA on this keyword unconditionally (#21490) 2018-02-02 00:30:03 -08:00
Wesley Wigham
aa5272dc89
Create import helpers for named imports if they contain default imports (#21550) 2018-02-01 15:38:18 -08:00
Wesley Wigham
a33dae3771
Rework how default vs local name selection is done to be more correct (#21526) 2018-02-01 12:34:25 -08:00
Wesley Wigham
058b2f7f11
Allow boolean literals to be generated from contextual types again (#21503)
* Allow boolean literals to be generated from contextual types again

* Update fourslash test
2018-02-01 12:34:16 -08:00
Wesley Wigham
c161c22d89
Avoid crashing when a source file is attempted to merge with another declaration (#21494) 2018-01-30 15:02:20 -08:00
Wesley Wigham
b0ea899d13
Use the full local file path as the id for a submodule (#21471)
* Use the full file path as the id for a submodule

* Informal code review feedback
2018-01-30 11:09:48 -08:00
Matt McCutchen
f0ba16c9a5 Unused type parameters should be checked by --noUnusedParameters, not (#21167)
--noUnusedLocals.

Fixes #20568.
2018-01-25 16:18:35 -08:00
Nathan Shively-Sanders
b80081d0cb
Merge pull request #21285 from Microsoft/nested-excess-property-checking-for-discriminated-unions
Nested excess property checking for discriminated unions
2018-01-25 15:59:57 -08:00
Manoj Patel
afc588eb9e --emitDeclarationsOnly flag to enable declarations only output (#20735)
* Add emitOnlyDeclarations flag

* Fix name

* verifyOptions checking logic

* Passing tests

* doJsEmitBaseline

* Tests !!!
2018-01-25 15:35:18 -08:00
Nathan Shively-Sanders
6087aaa297 Merge branch 'master' into nested-excess-property-checking-for-discriminated-unions 2018-01-25 15:32:53 -08:00
Wesley Wigham
ba797f2c50
Add flag to skip qualification check when symbol is already in the process of being qualified (#21337) 2018-01-24 12:37:45 -08:00
Nathan Shively-Sanders
a3387cc41f
Merge pull request #21328 from Lazarus535/master
Fixes #17080
2018-01-22 14:08:21 -08:00
Nathan Shively-Sanders
97fb0fd55f Add semicolon to unused class member list
Turns out SemicolonClassElement is a specific kind for semicolons inside
a class. Having one of them with --noUnusedLocals on would crash the
compiler after the assert added in #21013.
2018-01-22 12:59:53 -08:00
Stephan Ginthör
d11341820e Fixes #17080
Fixed the two requested changes.
1) Deleting the file "pull_request_template.md"
2) Declaring functions in tests, instead of defining
2018-01-22 21:45:37 +01:00
Stephan Ginthör
5a87a94c59 Fixes #17080
https://github.com/Microsoft/TypeScript/issues/17080
Added testcases from the Github bugreport (all working as intended now).
Signed CLA.
2018-01-22 13:40:57 +01:00
Stephan Ginthör
18e1ac0306 Fixes #17080
Changes are in src/compiler.checker.ts only
The second arguments to the function "removeOptionalityFromDeclaredType" has been changed from "getRootDeclaration(declaration)" to "declaration".
2018-01-22 09:52:58 +01:00
Wesley Wigham
d4c36120cf
Make nonnull assertions and binding patterns apparent declared type locations (#20995)
* Use apparent type of original type to handle indexes

* Redo older fix causing new bug by extending getDeclaredOrApparentType instead of getTypeWithFacts

* Rename symbol
2018-01-19 16:06:42 -08:00
Nathan Shively-Sanders
eed85737b8
Merge pull request #21271 from Microsoft/infer-keyof-to-any-not-empty
Inference of string literals to keyof creates an object with props of type `any`, not `{}`
2018-01-19 13:35:22 -08:00
Anders Hejlsberg
f6c79a631c Add regression test 2018-01-18 17:28:37 -08:00
Nathan Shively-Sanders
6ccf9bce8f Test:Nested excess property checking w/discriminated unions 2018-01-18 15:11:29 -08:00
Nathan Shively-Sanders
39fee67d8e
Merge pull request #21110 from jack-williams/strict-null-empty-destructuring
Fix #20873: Enforce strictNullChecks for RHS of empty destructuring assignment
2018-01-18 14:24:50 -08:00
Andy
b5ae9de7ba
Add grammar error for const { ...a: b } = {}; (#21267)
* Add grammar error for `const { ...a: b } = {};`

* Fix bug: bring in forEachChild change from #21268
2018-01-18 10:57:35 -08:00
Nathan Shively-Sanders
f0b4018017 Infer:string literal->keyof creates any props not {} 2018-01-18 08:44:57 -08:00
Wesley Wigham
99d6b0d308
Actually get the apparent type of intersection members when calculating intersection apparent types (#21133)
* Actually get the apparent type of intersection members when calculating intersection apparent types

* Add nonjsx variant

* Fix nit
2018-01-17 15:20:09 -08:00
Benjamin Lichtman
8f6c516ef9
Merge pull request #21205 from uniqueiniquity/resolveTripleSlashReferencePaths
Fix Windows-style absolute paths in triple-slash directives
2018-01-17 12:31:46 -08:00
Andy
61fb845b87
Get packageId for relative import within a package (#21130)
* Get packageId for relative import within a package

* Code review

* Rename things and add comments

* Improve documentation

* Test for scoped packages
2018-01-17 11:14:03 -08:00
Ron Buckton
16b13fe449 Fix incorrect parenthesization logic for conditional expression branches 2018-01-16 15:17:04 -08:00
Anders Hejlsberg
64b3086f5e
Merge pull request #21157 from Microsoft/fixEmptyArrayInference
Fix empty array inference
2018-01-16 12:42:26 -08:00
Wesley Wigham
154c6141f1
Allow functions to be printed structurally in declaration emit even when they have symbols (#21203)
* Allow functions to be printed structurally in declaration emit even when they have symbols

* Implement CR feedback and fix lint
2018-01-16 12:37:15 -08:00
uniqueiniquity
5ea43db6ec Add test 2018-01-16 11:27:20 -08:00
Wesley Wigham
2e1738bffa
Enable substitution for object literal shorthand property assignments in the system transform (#21106) 2018-01-12 18:24:41 -08:00
Wesley Wigham
64305edbce
Skip outer expressions when checking for super keyword in binder (#20164)
* Skip outter expressions when checking for super keyword in binder

* use TransformFlags to optimize and correct super call transforms

* Lint
2018-01-12 18:24:02 -08:00
Nathan Shively-Sanders
d74820d519 Remove mapped types to never from intersections
when transforming an indexed access type in order to get its constraint.
2018-01-12 14:43:31 -08:00
Anders Hejlsberg
13bf022ef6 Add regression tests 2018-01-11 16:45:44 -08:00
Nathan Shively-Sanders
baf31ec52e Test Diff and Omit 2018-01-11 16:30:05 -08:00
Nathan Shively-Sanders
c0dd832e46 Test:incorrect mapped type doesn't infinitely recur 2018-01-10 15:40:37 -08:00
Jack Williams
4acdca5258 Enforce strictNullChecks for RHS of empty destructuring assignment
When strictNullChecks is on, check the RHS of the following
destructuring assignments for possible null or undefined:

const {} = ...
const [] = ...
let {} = ...
let [] = ...
({} = ...)
2018-01-10 01:46:36 +00:00
Wesley Wigham
c9ef52b9d8
Do not always instantiate jsx signatures (#21108) 2018-01-09 17:22:19 -08:00
Stanislav Iliev
03fd77657d Issue implicit any errors for mapped types without annotations (#21104)
* Fixed #21011

* Updated code of merged message

* Reversed message code change and moved error to it's appropriate position

* Applied suggested improvements

* Fixed wrong diagnostics message in checker

* Reverted diagnostic message change
2018-01-09 17:11:57 -08:00
Wesley Wigham
fdd8a52240
Offer per-member diagnostics for incorrectly implemented inherited members (#21036)
* Offer per-member diagnostics for incorrectly implemented inherited members on classes

* Revise error message, make containingChain a thunk

* Fix typo in comment
2018-01-09 10:20:07 -08:00
Andy
5ab5694a5b
Don't count self-reference in more cases (skip more nodes when setting lastNonBlockLocation) (#21095) 2018-01-09 09:53:39 -08:00
Remo H. Jansen
73e3e8d790 Fixes #20026 (#20157)
* Added test case for #20026

* Implemented #20026

* Addresed comments at Microsoft/TypeScript/pull/20157#discussion_r152086287

* Fixed merge issues

* Fixed baseline issue

* Merged upstream
2018-01-08 17:25:56 -08:00
Andy
37d4f6a69d Mark references to dynamically-named properties as used (#21010)
* Mark references to dynamically-named properties as used

* Avoid showing the symbol ID

* Use symbolToString instead of showSymbol
2018-01-08 16:44:58 -08:00
Wesley Wigham
7e6315075d
Synthesize namespace records for proper esm interop (#19675)
* Integrate importStar and importDefault helpers

* Accept baselines

* Support dynamic imports, write helpers for umd module (and amd is possible) kinds

* Accept baselines

* Support AMD, use same helper initialization as is normal

* update typechecker to have errors on called imported namespaces and good error recovery with a quickfix

* Overhaul allowSyntheticDefaultExports to be safer

* Put the new behavior behind a flag

* Rename strictESM to ESMInterop

* ESMInterop -> ESModuleInterop, make default for tsc --init

* Rename ESMInterop -> ESModuleInterop in module.ts, add emit test (since fourslash doesnt do that)

* Remove erroneous semicolons from helper

* Reword diagnostic

* Change style

* Edit followup diagnostic

* Add secondary quickfix for call sites, tests forthcoming

* Add synth default to namespace import type, enhance quickfix

* Pair of spare tests for good measure

* Fix typos in diagnostic message

* Improve comment clarity

* Actually accept the updated changes to the esmodule interop description

* ESModule -> esModule

* Use find and not forEach

* Use guard

* Rely on implicit falsiness of Result.False

* These should have been emit flags
2018-01-08 16:36:23 -08:00