Commit graph

3286 commits

Author SHA1 Message Date
Wesley Wigham 293816875c
Support some late-bound special property assignments (#33220)
* Support some late-bound special property assignments

* Integrate PR feedback

* PR feedback

* Enable declaration on core tests

* Specialize type of binary expression used for late binding, speculative fix to navigation bar, merge check and type for elem/property accesses

* Add test showing current nav bar behavior (specifically the lack thereof)
2019-09-27 13:54:50 -07:00
Andrii Dieiev a34fdb203e Better template literals support in checker (#32064)
* Support template literals in enum declarations

* Support template literals in const enum access

* Support template literals in swith with typeof narrowing

* Support template literals in element access discriminant

* Support template literals in ambient module declaration

* Unify symbols for template literals in computed properties

* Unify expression position checks for template literals

* Support template literals in rename and find all references

* Mark computed properties with template literals as write access

* Inline startsWithQuote
2019-09-27 12:04:13 -07:00
Collins Abitekaniza c0573c59c9 Prevent collision of imported type with exported declarations in current module (#31231)
* check for exported type name for conflict

* refactor baseline tests for import/export name collision
2019-09-27 07:55:04 -07:00
Wesley Wigham 61cb06ce40
Allow allowJs and declaration to be used together (#32372)
* Allow allowJs and declaration to be used together

This intorduces a new symbol-based declaration emitter - currently this
is only used for JSON and JavaScript, as the output is likely worse than
what the other declaration emitter is capable of. In addition, it is
still incomplete - it does not yet support serializaing namespaces.

* Add tests for various import/export forms, add notes on export as namespace and fix export * from

* Tests & fixes for computed names

* Add test with current @enum tag behavior

* fix declaration emit for jsdoc @enum tags

* Small adjustments to base class serialization to fix bugs in it

* Guard against type/type parameter confusion when using typeParameterToName a bit

* Integrate feedback from PR

* Fix issue with export= declarations visibility calculation and type declaration emit that impacted all forms of declaration emit

* Only make one merged getCommonJsExportEquals symbol for a symbol

* Support preserving type reference directives in js declarations

* Skip declare mdoifiers for namespace members in ambient contexts

* FAKE ALIASES AND NAMESPACES EVERYWHERE

* Dont do namespace sugar when type members contain keyword names

* Fix json source file export modifier under new output

* Such clean nested aliasing, very wow

* Fix lint

* Add visibility errors, reuse type nodes where possible

* Suppoer having correctly named import types in bundled js declaration emit & adjust binding to allow namespaces with aliases to merge when the aliases look to be type-only

* Better support for module.exports = class expression

* Fix discovered crash bug

* Allow export assigned class expressions to be reachable symbols from external declarations

* Add missing semicolon

* Support @enum tag post-merge

* preserve comments on signatures and declarations where possible

* Basic support for js classy functions

* Add example we should do better with

* Prototype assignments make things a bit wonky, but the example from the PR seems OK

* Make a ton of changes to support the new way js classes are bound

* Remove some old comments, fix import and export default names

* Fix bug in object define handling and add tests for object define property declaration emit

* Fix organization nits from PR comments

* Preserve comments from jsdoc declarations on properties and js declaration type aliases

* Merge export declarations with identical specifiers

* Remove completed TODO comment

* Split lint

* Remove now-unused function

* PR feedback

* Add some project references tests, remove some checks from project refs codepaths that are now invalid

* Update project references tests again

* Merge and update project references tests

* Rename case

* Update test to include declaration output

* Remove yet another project refernces redirect extension check

* Update comment

* Add additional import ref to test

* Add shorthand prop to test

* Fix comment text

* Extract var to temp

* Simplify function and add whitespace

* Update project refs test to use incremental edit entry

* Stylistic refactors in the symbol serializer

* Another round of PR feedback, mostly style, small bugfix with constructors, and test showing bug in export assigned class expression name shadowing

* Use x instead of index
2019-09-26 14:27:16 -07:00
Orta Therox 4c9986f26c Merge master 2019-09-25 12:59:07 -04:00
Anders Hejlsberg bf992a57f6
Merge pull request #32695 from microsoft/assertionsInControlFlow
Assertions in control flow analysis
2019-09-23 16:57:56 -07:00
Wesley Wigham 00a43d7b49
Cache propagating variance flags in the relationship cache (#32225)
* Cache propagating variance flags in the relationship cache

* Convert base fields in relation comparison result to flags
2019-09-23 16:55:19 -07:00
Wesley Wigham 26caa3793e
Introduce flattened error reporting for properties, call signatures, and construct signatures (#33473)
* Introduce flattened error reporting for properties, call signatures, and construct signatures

* Update message, specialize output for argument-less signatures

* Skip leading signature incompatability flattening

* Add return type specialized message
2019-09-23 16:08:44 -07:00
Wesley Wigham 6c2ae12559
Relax the constraints of isValidBaseType to allow base types to be constructor types (#33146)
* Relax the constraints of isValidBaseType to allow base types to be constructor types

* Fix nit

* Reduce confusion between isConstructorType and isValidBaseType

* Update comment
2019-09-23 15:58:03 -07:00
Anders Hejlsberg 5d09688c1e
Merge pull request #33228 from microsoft/fix32976
Less aggressive contextual signature instantiation
2019-09-21 07:31:24 -07:00
Anders Hejlsberg c3dcc37c79 Merge branch 'master' into assertionsInControlFlow
# Conflicts:
#	src/compiler/checker.ts
2019-09-20 17:23:27 -07:00
Anders Hejlsberg 21b5418cef Add tests 2019-09-20 17:17:39 -07:00
Jack Bates 78057a64ac Allow readonly arguments to Promise.all(), etc. 2019-09-19 11:11:59 -07:00
Wesley Wigham 5e06bea481
getConstraintDeclaration gets the first declaration with a constraint… (#33426)
* getConstraintDeclaration gets the first declaration with a constraint, rather than just the first declaration

* Add type annotation

* Update comment
2019-09-18 13:56:24 -07:00
Wesley Wigham 683e281040
Reintroduce cloneInferredPartOfContext to fix overloaded inferences with returnMappers (#33478) 2019-09-18 13:14:39 -07:00
Ron Buckton 344dba8809
Fix incorrect parameter types for AsyncIterator next/return (#33354) 2019-09-17 21:02:12 -07:00
Wesley Wigham 56e2cb31ad
Reverse mapped types should have inferable indexes if their source had an inferable index (#33450) 2019-09-17 15:36:00 -07:00
Orta 2c967c49eb
Merge branch 'master' into ts-in-js 2019-09-11 21:22:01 +02:00
Orta 7435425842
Merge pull request #33199 from jack-williams/fix-32809
Fix #32809
2019-09-11 21:07:00 +02:00
Jack Williams 630499eca2 Assume void variables are initialized 2019-09-11 00:02:39 +01:00
Alexander 9ee2b4d526 Merge branch 'master' of https://github.com/Microsoft/TypeScript into feature/eslint 2019-09-07 10:11:49 +03:00
Wesley Wigham a93298665c
Add heuristic for extracting irreducible null and undefined types from intersections of unions (#33150) 2019-09-06 11:32:22 -07:00
Alexander T 4584b31db8 Merge branch 'master' of https://github.com/Microsoft/TypeScript into feature/eslint 2019-09-05 17:16:25 +03:00
Anders Hejlsberg c5e6d95e93
Merge pull request #33252 from microsoft/fix33131
Make lower priority inference when source is completely matched in target
2019-09-05 06:27:23 -07:00
Alexander T 7ea134bacd Merge branch 'master' of https://github.com/Microsoft/TypeScript into feature/eslint 2019-09-05 09:52:04 +03:00
Wesley Wigham 72bb4c2bdc
Mark deep indexed access comparisons as expanding (#33144)
* mark deep indexed accesses as deeply nested in comparisons

* Add test derived from lodash example
2019-09-04 17:00:55 -07:00
Anders Hejlsberg 5de180e878 Merge branch 'master' into fix33131
# Conflicts:
#	src/compiler/checker.ts
2019-09-04 16:54:11 -07:00
Anders Hejlsberg 228b727ff1 Add regression test 2019-09-04 16:49:59 -07:00
Wesley Wigham 3109b646a6
Elevate mapped types over type parameters in the same way as naked type parameters in intersection inference prioritization (#33223) 2019-09-04 16:23:08 -07:00
Nathan Shively-Sanders 8ca36f3516
someTypeRelatedToType now passes isIntersectionConstituent (#33213)
* someTypeRelatedToType now passes isIntersectionConstituent

* Fix [][] lint
2019-09-04 13:36:50 -07:00
Anders Hejlsberg 4bd9b62fa6 Add regression tests 2019-09-03 17:23:43 -07:00
Justin Bay 3c9e338396 Only error when testing functions that are not used in the following block 2019-08-31 18:29:11 -04:00
Justin Bay 006a327320 Flag non-nullable values with call expressions in if statements as errors 2019-08-31 14:24:31 -04:00
Alexander T 0d941d6943 Merge branch 'master' of https://github.com/Microsoft/TypeScript into feature/eslint 2019-08-21 10:02:57 +03:00
Wesley Wigham a34ac8084c
Walk up parenthesized type nodes when looking for the type alias hosting a node (#32924) 2019-08-20 16:43:06 -07:00
Alexander T fea9e11174 Merge branch 'master' of https://github.com/Microsoft/TypeScript into feature/eslint 2019-08-20 11:07:18 +03:00
Wesley Wigham fd1e22bbf1
Instantiate generic conditional infer source types in the context of the target conditional (#31545)
* Instantiate generic conditional infer source types in the context of the target conditional

* Add test case from #26627
2019-08-19 13:01:08 -07:00
rChaser53 d75de60548 Fix Cannot read property 'text' of undefined crash (#32734)
* Fix Cannot read property 'text' of undefined crash

* fix condition for tsx

* Rename and improve the method
2019-08-19 12:08:34 -07:00
Wesley Wigham d9f0212324
Resolve SymbolFlags.Type only at first in jsdoc getTypeFromTypeReference (#32947)
* Fix lookup of exported eunm type alias in local scope in JS

* Fix by adjusting type lookup fallback behavior to not include SymbolFlags.Value in its initial lookup instead
2019-08-19 11:31:47 -07:00
Klaus Meinhardt 1d942f4ddc Detect more TS syntax in JS files
* optional class methods
* type arguments on tagged template expressions
2019-08-18 21:46:53 +02:00
Alexander a7f41621fb Merge branch 'master' of https://github.com/Microsoft/TypeScript into feature/eslint 2019-08-17 16:37:39 +03:00
Brendan Kenny f45add0a7d checkJs: require JSDoc type argument for Array, Object, and Promise in noImplicitAny (#32829)
* Require type argument for JSDoc Array, Object, and Promise in noImplicitAny

* add jsdoc Array/Object/Promise noImplicitAny tests
2019-08-16 12:41:09 -07:00
Alexander T b6d981aec8 Merge branch 'master' of https://github.com/Microsoft/TypeScript into feature/eslint 2019-08-16 12:13:57 +03:00
阿卡琳 a53e4a19ef Allow to omit the begin parameter of %TypedArray%.prototype.subarray (#32125)
* Allow to omit the begin parameter of %TypedArray%.prototype.subarray

* update baselines
2019-08-15 15:58:24 -07:00
Tan Li Hau dcb763f624 Report error when using generic class in js file (#31723)
* Report error when using generic class in js file

* Replace "ClassDeclaration | ClassExpression" to ClassLikeDeclaration

Co-Authored-By: Klaus Meinhardt <klaus.meinhardt1@gmail.com>

* add noEmit:true
2019-08-15 15:49:50 -07:00
Orta 6cd8bcd6c9
Merge pull request #31185 from collin5/b30851
Restrict spreading for Instantiable Type with non object constraint
2019-08-15 13:50:01 -07:00
Kagami Sascha Rosylight f304b81fa5 Point es2020 in esnext.d.ts (#32776) 2019-08-15 10:06:46 -07:00
Alexander T f20a2828f2 Merge branch 'master' of https://github.com/Microsoft/TypeScript into feature/eslint 2019-08-15 10:32:45 +03:00
Klaus Meinhardt 8eeb763cdd report invalid modifiers on class expression properties
Fixes: #32532
2019-08-14 21:00:19 +02:00
Sheetal Nandi 0e93cf61fc Disallow incremental with noEmit
Fixes #32882
2019-08-14 09:47:49 -07:00