2501 Commits

Author SHA1 Message Date
Wesley Wigham
c1128d6957
Fix declaration emitted crash on mapped type with no type (#22213) 2018-02-27 16:12:03 -08:00
Wesley Wigham
0dc5f18bdb
Remove excess comment ranges from initialized and property parameter emit (#22152) 2018-02-26 12:43:31 -08:00
Alex Eagle
2e66e74e14 fix --pretty output when context is multi-line
Fixes #22097
2018-02-22 22:56:00 -08:00
Wesley Wigham
66fa9f6cd7
Just map type variables to constraints at certain positions for narrowing so that we do not map primitives (#21384)
* Use a limited version of getApparentType that doesnt map primitives

* Reuse [most of]  getBaseConstraintOfType, since it does the needed behaviors

* Move new function next to the very similar function
2018-02-21 12:51:26 -08:00
Andy
9ee51fadd9
Have Symbol#isReferenced check the SymbolFlags of the reference (#21996) 2018-02-16 16:47:13 -08:00
Andy
a133cec246
Fix bug: Interface type parameter merged with property is not unused (#21966) 2018-02-15 09:30:58 -08:00
Andy
2ee92948d8
Support @param tag on property declaration initializer (#21907)
* Support @param tag on property declaration initializer

* Update test

* Finish updating test
2018-02-14 10:12:38 -08:00
Adrian Leonhard
6ab5d97a5d Changed "Duplicate Identifier" to "enum cannot be merged..." (#18579)
* Changed "Duplicate Identifier" to "enum can only be merged..."
when either declaration of the identifier is an enum.

Partial (?) fix for #529

Not sure if the new test is necessary, all the cases seem to have been covered by others tests.

* picked a nit
2018-02-12 13:38:08 -08:00
Andy
2d80253d09
Fix error message for implicit-any property in object literal with symbol key (#21883) 2018-02-12 11:09:50 -08:00
jack-williams
67984c720e Fix #21848: Allows to mutate const with non-null assertion (#21873) 2018-02-12 10:57:59 -08:00
Mohamed Hegazy
3fb481ff40
Multiple telemetry debug assert failure fixes (#21886)
* Use getAllowSyntheticDefaultImports to access `--allowSyntheticDefaultImport` value

* Fix #21788: Handel missing imporotClause case

* Fix #21789: Add a defensive check to forgottenThisPropertyAccess code fix for non-identifier locations

* Do not suggest prefix with `this` if the name we are looking for is diffrent from the errorLocation

* Fix #21796: Handel case of unknown module

* Add check to capture more info for #21800

* Fix #21807: check for symbol before looking up its flags

* Fix #21812: Gracefully fail if the token is not `this`.
2018-02-12 10:34:17 -08:00
Alan Agius
3893ed498f fix: matchedText module resolution incorrect length (#21647)
* fix: `matchedText` was not properly extract the correct parts from the candidate

closes: #21636

* core: replace `substr` with `substring` in `matchedText`

* test: remove redundant code from tests
2018-02-07 12:54:37 -08:00
Wesley Wigham
17554ff285
Fix JSX contextual types to not eagerly become apparent, use 2-pass inference for JSX (#21383)
* Fix JSX contextual types to not eagerly become apparent

* Apply changes from code review, unify common code

* Fix jsx children contextual typing

* Light code review feedback

* Use fillMissingTypeArguments

* Accept nonliteral jsx child type

* Add test for the fillMissingTypeArguments case
2018-02-05 16:33:39 -08:00
Anders Hejlsberg
3b220a8b0f
Merge pull request #21649 from Microsoft/conditionalTypesASI
Conditional types ASI
2018-02-05 16:21:34 -08:00
Mohamed Hegazy
8f8fec433e
Rename switch --emitDeclarationsOnly to --emitDeclarationOnly (#21651)
* Rename `--emitDeclarationsOnly` to `--renameDeclarationOnly`

* Rename test files
2018-02-05 14:48:50 -08:00
Anders Hejlsberg
6cf640ed3b Add regression test 2018-02-05 13:56:22 -08:00
Anders Hejlsberg
21c397dd5a Add regression test 2018-02-03 14:45:16 -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