Ron Buckton
d261d4d510
Treat void-typed properties as optional
2020-09-29 13:36:52 -07:00
Wesley Wigham
a91c2879ef
Allow discrimination to identical object types when discriminating contextual types ( #40574 )
...
* Merge identical object types when discriminating contextual types
Co-authored-by: Orta <ortam@microsoft.com>
* Allow identical discriminants when discriminating, rather than trying to unify identical union members
* Fix lint
Co-authored-by: Orta <ortam@microsoft.com>
2020-09-23 00:51:14 -07:00
uhyo
61910e8c97
Fix missing constraints for parenthesized infer T ( #40406 )
...
* add tests
* consider parenthesized types in getInferredTypeParameterConstraint
* update tests
2020-09-23 00:48:40 -07:00
Wesley Wigham
10b240cde3
Allow an infer type node to resolve its own name ( #40483 )
2020-09-22 21:21:13 -07:00
Andrew Branch
735a67a05e
Fix iterable contextual type ( #40592 )
2020-09-17 10:42:47 -07:00
Wesley Wigham
98314d77e8
Use unexpanded parameter list in serialization when the expanded list has a non-trailing variadic position ( #40556 )
2020-09-14 19:56:24 -07:00
Wesley Wigham
94123d5744
Issue a diagnostic when the node builder performs truncation despite the NoTruncation flag being set ( #40477 )
2020-09-14 12:20:57 -07:00
Andrew Branch
9c8d11b5ed
Allow 'paths' without 'baseUrl' ( #40101 )
...
* Allow paths without baseUrl
* Remove exception for leading * paths
* Add comment, remove commented code
* Update baselines
* Remove unnecessary default
* Fix test harness
* Fix baseline
* Resolve relative to host.getCurrentDirectory() with createProgram API
2020-09-11 12:58:40 -07:00
Orta Therox
aa2756a5d7
Updates Dom lib with TSJS changes, adding a new library for webworker iterable ( #40500 )
...
* Updates Dom lib with TSJS changes, adding a new library for webworker iterable
Co-authored-by: Nathan Shively-Sanders <nathansa@microsoft.com>
* Fixes tests
Co-authored-by: Nathan Shively-Sanders <nathansa@microsoft.com>
2020-09-11 15:36:00 -04:00
Orta Therox
cdafb7157b
Replaces the default module index resolver with '/index' instead of '' when handling internal routing for dts bundles ( #39277 )
...
* Adds support for declaring the bundled name of a dts module export
Co-authored-by: Wesley Wigham <wwigham@gmail.com>
* Adds baselines
* Update the tests
* Try to reduce the scope of the bundledPackageName error
* Use the flag in more baselines
* Get it green
* More tests
* Handle more feedback
* More test cleanup
* Set the moduleResolution for the tsconfigs
Co-authored-by: Wesley Wigham <wwigham@gmail.com>
2020-09-11 08:12:07 -04:00
Orta Therox
fa89ce6158
Remove assignability cases in getNarrowedType + an isArray improvement for readonly arrays ( #39258 )
...
* Explore using a different isArray declaration
* Add tests and the new isArray definition
* Baseline updates
* Upda the isArray type
2020-09-08 14:43:48 -04:00
Wesley Wigham
7838b0172a
Add errors when providing type arguments for intrinsic JSX tags ( #40293 )
2020-09-08 10:29:15 -07:00
Wesley Wigham
e5fd0dd1e3
Allow private symbols to be control flow narrowed ( #39978 )
...
* Allow private symbols to be control flow narrowed
* Add test with narrowing of inferred control flow type for completeness
* Reformat long line
2020-09-05 02:48:45 -07:00
Eric Anderson
79f919e8f5
Fixes stack overflow when exporting a lot in commonjs ( #38994 )
...
* Fixes stack overflow when exporting a lot in commonjs
Fixes #38691
* Add missing test files
2020-09-04 09:01:59 -07:00
Alexander T
01362a3ac1
feat(part of 40169): add spelling suggestion/quick fix for module/namespace exported members ( #40211 )
2020-08-29 01:01:06 -07:00
Eli Barzilay
746bdb7946
Fix getContextualTypeForBindingElement for arrays
...
When handling an array type, the lookup should use the position index
instead of the identifier name.
Also uncomment the tests in the `staticFieldWithInterfaceContext.ts`
test which failed because of this bug.
Fixes #40158 .
2020-08-26 16:28:50 -04:00
Alexander T
2dd7a4bf93
fix(31046): add new diagnostic message for incompatible constructor signature ( #40073 )
2020-08-22 13:26:13 -07:00
Alexander T
9569198df6
fix(25770): add diagnostic message for the possible mapped type used as an index ( #39973 )
2020-08-21 10:42:48 -07:00
Alexander T
6ec3629ef4
fix(26325): use a unique name for reserved words in 'constructor like' function name ( #39684 )
2020-08-21 09:47:37 -07:00
Eli Barzilay
f9e360d44b
Add missing contextual type to static PropertyDeclarations
...
Makes it possible to type class static fields.
Fixes #33897 .
2020-08-20 19:12:55 -04:00
Andrew Branch
dbab46c363
The falsy part of any/unknown is any/unknown ( #39529 )
2020-08-18 11:06:44 -07:00
Wesley Wigham
f9cca25cd7
Fix lack of error on default export of nonexistant name ( #40094 )
...
* Modify test harness so it can report underlying issue, fix small parent pointer issue
* Fix underlying export asignment check issue and fix lints
* Ensure class/function duplicate declaration errors are reported regarless of which is encountered first
* Ensure flag conflict errors are reported regardless of which declaration is encountered first
2020-08-17 15:30:19 -07:00
Anders Hejlsberg
cd30534327
Recursive conditional types ( #40002 )
...
* Support recursive conditional types
* Accept new API baselines
* Accept new baselines
* Simplify recursive type tracking in type inference
* Accept new baselines
* Add tests
* Accept new baselines
* Revise recursion tracking in type inference
* Revise tests
* Accept new baselines
* Add more tests
* Accept new baselines
2020-08-15 18:22:30 -07:00
Ron Buckton
fca9f451d8
Add missing 'importName' for private field helpers ( #39932 )
2020-08-06 13:27:19 -07:00
Nathan Shively-Sanders
d3877d294c
Redo in narrowing for intersections ( #39637 )
...
* Redo in-narrowing for intersections
Still need to carve out an exception for globalThis
* exempt globalThis from `in` narrowing
2020-07-30 14:58:22 -07:00
mshivaku99
bffe3540fa
Issue35876: Give better error message when Classic Module Resolution with incorrect path ( #38105 )
...
* added Error 5084 to diagnosticMessages.json
* added test case errorForBareSpecifierWithImplicitModuleResolution1 to tests/cases/compiler
* modified checker.ts to report error 5084 when classic resolution and incorrect path are used
* added baseline changes
* passes all test cases including src/testRunner/unittests/ tests
* Update with feedback
* Make it check whether it is the right module resolution kind
* Use the right diagnostic message in tsserver tests
Co-authored-by: Meera Shivakumar <mshivaku@umich.edu>
Co-authored-by: Orta <git@orta.io>
2020-07-30 13:45:29 -04:00
Eli Barzilay
a320e1b554
Make getLocalSymbolForExportDefault look harder for an export
...
Look for a symbol that has a `.localSymbol` property instead of blindly
using the first one.
Fixes #37829 .
2020-07-30 13:09:21 -04:00
Eli Barzilay
f2d1531768
Fix location for duplicate function implementation errors
...
Use only the relevant declarations (by collecting them in the for loop),
and use `declaration` if `getNameOfDeclaration` didn't work (useful for
`export default` with anonymous functions).
Fixes #39804 .
Also, use `nodeIsPresent` once, and a random `?.`.
2020-07-29 16:07:00 -04:00
Song
5484687384
switch typeof any could be checked for unreachable ( #39389 )
...
* switch typeof any could be checked for unreachable
* fix stupid error
* support unknown
* remvoe use less code.
* fix spelling.
2020-07-21 13:51:27 -04:00
Anders Hejlsberg
94d6b4507e
Consistent errors on circular base types ( #39675 )
...
* Properly track and report errors on circular base types
* Accept new baselines
* Add regression test
2020-07-20 20:35:47 -07:00
Alexander T
92f41c81fb
tests(39373): add addition tests ( #39631 )
2020-07-17 13:30:57 -07:00
Alexander T
4e24b1b00d
fix(39373): add diagnostic message about using a private name for class declarations without name ( #39567 )
2020-07-16 17:05:33 -07:00
uhyo
b6f09ccf06
Better error message for unparenthesized function/constructor type notation in union/intersection types ( #39570 )
...
* add graceful error message for unparenthesized function types in union and intersection
* add unparenthesizedFunctionTypeInUnionOrIntersection test
* add unparenthesizedConstructorTypeInUnionOrIntersection test
* Update src/compiler/parser.ts
Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
* pass isInUnionType to parseFunctionOrConstructorTypeToError
* Apply suggestions from code review
Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
* syntax fix
* refactor isStartOfFunctionType into isStartOfFunctionTypeOrConstructorType
* Update src/compiler/parser.ts
Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
* hoist isUnionType
Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2020-07-15 14:43:56 -07:00
Sheetal Nandi
37e6e2761c
Do not resolve require calls in typescript files even if it contains dynamic import ( #39617 )
...
* Existing tests showing require in ts file is not used for module resolution
* Do not resolve require calls in typescript files even if it contains dynamic import
Fixes #38611
2020-07-15 14:31:55 -07:00
Wesley Wigham
f2c5643056
Flag mapped types with circular property types and do not attempt to print them structurally ( #39552 )
2020-07-15 11:19:43 -07:00
Wesley Wigham
ef9affe2f6
Use jsxFragmentFactory entity name for factory name lookup from checking fragments ( #39475 )
2020-07-14 17:25:45 -07:00
Ron Buckton
5ad8532a11
Merge branch 'master' into fix37113
...
# Conflicts:
# src/compiler/transformers/module/module.ts
2020-07-13 11:13:35 -07:00
Anders Hejlsberg
c335aad665
Remove object literal freshness in control flow based array types ( #39518 )
...
* Remove object literal freshness in control flow based array types
* Add regression test
2020-07-10 10:18:15 -07:00
Ron Buckton
ae2f0068e3
Fix default import/export helper usage
2020-07-09 13:13:48 -07:00
Alexander T
7c99086eb8
fix(39524): convert access property suggestion to string ( #39527 )
2020-07-09 11:08:44 -07:00
Ron Buckton
5c5f180f8e
Fix namespace import/export helper usage
2020-07-07 17:36:59 -07:00
Wesley Wigham
4f375552b5
Fix crash in decorator metadata calculation when serializing template literal type nodes ( #39481 )
2020-07-07 15:29:52 -07:00
Orta Therox
6ebd73c84f
Don't narrow against unions of constructor functions with instanceof ( #38099 )
...
* WIP
* Only narrows when the union is not all constructors
2020-07-07 11:34:10 -04:00
Anders Hejlsberg
2fe2f88047
Fix control flow analysis for nested try-catch-finally statements ( #39399 )
...
* Fix control flow analysis for nested try-catch-finally statements
* Add tests
2020-07-03 09:51:01 -07:00
Wesley Wigham
ff1f449b99
Fix type of computed name following spread ( #39319 )
2020-06-30 13:37:59 -07:00
ShuiRuTian
4601a786aa
not narrow static property without type annotation in constructor. ( #39252 )
...
* fix #39226
* fix lint.
2020-06-26 11:08:35 -07:00
Wesley Wigham
a3ee09ddc9
Handle recursive type references up to a certain level of expansion in inference ( #38011 )
...
* Handle recursive type references up to a certain level of expansion in inference
* Move object cases into the same conditional branch
2020-06-24 14:24:34 -07:00
Wesley Wigham
d1ebf126d2
Do not consider binding patterns in contextual types for return type inference where all the signature type parameters have defaults ( #39081 )
2020-06-24 13:45:17 -07:00
Wesley Wigham
7893c9fc7e
Do not add reexported names to the exportSpecifiers list of moduleinfo ( #39213 )
2020-06-23 17:56:44 -07:00
Daniel Rosenwasser
e6aedfd38b
Merge pull request #37907 from Jack-Works/feat/class-to-classname
...
feat: add a codefix to fix class to className in react & add spelling suggest for JSX attributes
2020-06-22 18:32:24 -07:00