Commit Graph
2463 Commits
Author SHA1 Message Date
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 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
Wesley Wigham b1a0261575 If declaration emit input is a module, output should be a module (#20626) 2018-01-08 13:58:34 -08:00
Wesley Wigham b2f2610b85 Use getInternalName not getLocalName (#20168) 2018-01-08 13:55:50 -08:00
Daniel Rosenwasser 6d596c058e Merge pull request #20726 from kujon/indexable_types
Improved error messaging for index signature parameters
2018-01-08 13:23:39 -08:00
Wenlu Wang a82d1f8580 ignore Initial check if left of DestructuringAsignment (#20906) 2018-01-08 13:13:23 -08:00
Wesley Wigham b5fda4970d Use emptyObjectType for omitted members instead of unknownType (#20940)
* Use emptyObjectType for omitted members instead of unknownType

* Use similar logic as is used for empty arrays for missing elements
2018-01-08 12:27:11 -08:00
Andy f83283c068 Improve parse error for double comma somewhere inside a call expression (#20399) 2018-01-08 10:38:55 -08:00
Nathan Shively-Sanders e78ac47208 Merge pull request #20711 from Microsoft/defer-inference-for-recursive-mapped-types
Defer inference for homomorphic mapped types
2018-01-05 16:01:26 -08:00
Andy c6e4373403 In checkAndAggregateReturnExpressionTypes, treat MethodDeclaration in an object literal same as a FunctionExpression (#20052)
* In checkAndAggregateReturnExpressionTypes, treat MethodDeclaration in an object literal same as a FunctionExpression

* Add original test case
2018-01-05 12:34:01 -08:00
Andy f6dc0ad707 Check for unused getter/setter in classes (#21013)
* Check for unused getter/setter in classes

* Write-only use of setter is still a reference; and don't error on setter if getter exists
2018-01-05 09:10:58 -08:00
Nathan Shively-Sanders 81a601bb49 Test:deferred mapped types 2018-01-03 15:54:43 -08:00
Nathan Shively-Sanders 7393433593 Merge branch 'master' into defer-inference-for-recursive-mapped-types 2018-01-03 12:19:21 -08:00
Daniel Rosenwasser 0477f91dba Merge pull request #20928 from Microsoft/initializerWithPropertyAccessUseBeforeDeclaration
Check whether we have a class before testing whether we have a super-class
2017-12-29 14:47:13 -08:00
Daniel Rosenwasser 0d56a0545c Added tests. 2017-12-29 12:30:18 -08:00
Wesley Wigham ae211983eb Add method signature handler to getTypeOfVariableOrParameterOrProperty (#20825) 2017-12-28 19:00:54 -08:00
Nathan Shively-Sanders 2df7a89e61 Merge branch 'master' into limit-recursive-structured-type-resolution 2017-12-22 14:41:58 -08:00
Nathan Shively-Sanders fb3042c3f7 Move recursion limiter to individual resolve* functions 2017-12-22 14:39:25 -08:00
Wesley Wigham cedcba9285 Reset partial memberlist on defered circularity to calculate the correct members (#20179)
* Reset partial memberlist on defered circularity to calculate the correct members

* Remove return type
2017-12-22 11:41:39 -08:00
Wesley Wigham 7ad0d7b9fd Fix higher order inference on indexed access types (#20165) 2017-12-21 14:47:03 -08:00
Wesley Wigham 00450f029c Not all extended types have symbols (#20827) 2017-12-21 13:07:29 -08:00
Anders Hejlsberg 2f4c8ebf13 Add regression test 2017-12-19 19:58:28 -08:00
kujon c92c7a5b10 Addressed the suggestions 2017-12-19 21:29:03 +00:00
Daniel Rosenwasser 69e091b40d Merge pull request #19797 from charlespierce/implements_class_error_message
Add new error message when class implements class
2017-12-19 11:39:05 -08:00
Wesley Wigham ae73a9141d Allow JSXAttributes types to be shortcut-spread into the spread type like normal objects (#19047)
* Bring jsx type resolution inline with normal objects, move jsx attribute property ignorign into relationship check

* Improved errors and reordered members

* Always use inferrential mode for jsx pass

* Add some missing skipLibChecks

* New check mode instead of odd type mapper

* Do not enable object literal freshness checks on jsx spreads

* Fix minor style nits

* Update order of type for test

* Accept corrected baseline
2017-12-15 16:13:28 -08:00