Zzzen
813ddf7909
ensure export modifier is used before default modifier ( #44570 )
...
* ensure export modifier is used before default modifier
* gracefully handle `default function`
* Revert "gracefully handle `default function`"
This reverts commit 1d8e2887540f5abaa8b7192fee89ef8935be8640.
* give better error message on default without leading export
2021-06-30 09:43:14 -07:00
Oleksandr T
5c8d76347c
fix(44448): disallow 'delete' operator for optional properties ( #44612 )
2021-06-29 16:56:45 -07:00
Andrew Branch
54b913cf31
Issue unawaited promise error on symbol-less expressions ( #44491 )
...
* Issue unawaited promise error on symbol-less expressions
* Use same behavior for call expressions
* Revert "Use same behavior for call expressions"
This reverts commit 60d58132e4ecfba063b5c9df06acdd05b25decdf.
2021-06-28 12:35:58 -05:00
Wenlu Wang
dc237b317e
Change static fields emits ( #43114 )
...
* use emit into iife
* Update emit
* Revert un-related changes
* Allow super in static context
* Allow this and super in static property declaration
* Add more tests
* Avoid errors
* Accept baseline
* Accept baseline
* Add decorated classes test
* Add errors
* Avoid this in emitter
* make lint happy
* Add class expression tests
* Add computed name test
* Avoid super if target below es6
* Adjust function boundary
* Add internal
* Fix minor CR issues
* accept baseline
* Update behavior
* Avoid spaces
* Make lint happy
* Avoid function boundary utils
* Update baseline
* Avoid errors
* Accept baseline
* Accept baseline
* Accept baseline
* Accept baseline
* Use substitutions
* Full coverage for super, this, merge static and private context
* Fix use-before-def in static fields
Co-authored-by: Ron Buckton <ron.buckton@microsoft.com>
2021-06-25 15:49:27 -07:00
Orta Therox
9ebe11c2d3
Migrate latest dom types into libdom.d.ts ( #44684 )
...
* Add the types_web dom dts
* Update
* Adds new DTS
* Update baselines
2021-06-25 14:25:30 -07:00
exoticknight
9708022537
Fix 'arguments' check in class field initializer or static initialization block ( #44393 )
...
* Fix 'arguments' check in class field initializer or static initialization block
* return errorType
* Merge branch 'master' of https://github.com/exoticknight/TypeScript
* use isInPropertyInitializer
fix Diagnostics message
2021-06-21 16:57:48 -07:00
Oleksandr T
f850470d18
fix(44377): omit type alias declarations from JavaScript ( #44378 )
2021-06-18 14:59:31 -07:00
Nathan Shively-Sanders
0f216f36ec
Forbid duplicates in baselines ( #44652 )
...
* Forbid duplicates in baselines
The check is case insensitive.
* Update baselines and add semi-colons
Gotta have those semicolons.
2021-06-18 11:40:25 -07:00
Ryan Cavanaugh
5afe42e14e
Rename strictOptionalProperties -> exactOptionalPropertyTypes and remove from strict family ( #44626 )
2021-06-17 15:12:19 -07:00
Anders Hejlsberg
97b4063d73
Don't attach declarations to symbols in mapped types with 'as XXX' clauses ( #44609 )
...
* Don't attach declarations to symbols in mapped types with 'as XXX' clauses
* Add test (and tweak comment)
Co-authored-by: Eli Barzilay <eli@barzilay.org>
2021-06-16 16:07:33 -07:00
Anders Hejlsberg
a3eadfe905
Skip base type checks that can cause circularities ( #44615 )
...
* Don't do base type checks that can cause circularities
* Add regression tests
2021-06-16 13:36:43 -07:00
Armando Aguirre
d0159a8891
Fix late bound method name assignment, added tests ( #43344 )
...
* Fix late bound method name assignment, added tests
* Refactor bindDynamicallyNamedthisPropertyAssignment
* PR comments
* Rollback allowJscheck fix
2021-06-16 12:46:00 -07:00
Anders Hejlsberg
6bb1f0792b
Fixes to inference and mapped types in --strictOptionalProperties mode ( #44595 )
...
* Fix Required<T> and inference to index signatures in --strictOptionalProperties mode
* Add tests
* Accept new baselines
2021-06-15 14:16:38 -07:00
Anders Hejlsberg
5540364c12
Correct tuple relations in --strictOptionalProperties mode ( #44568 )
...
* Fix relations for optional elements in tuples with --strictOptionalProperties
* Accept new baselines
* Add regression test
* Address CR feedback
2021-06-13 12:53:13 -07:00
Anders Hejlsberg
6a1623d413
Ensure singleton types always compare identical ( #44565 )
...
* Singleton types should compare identical + fix boolean types
* Add tests
* Accept new baselines
2021-06-13 12:51:36 -07:00
Daniel Rosenwasser
9906092db2
Add flag to change catch variables' default types to unknown ( #41013 )
...
* Add test case for 'useUnknownInCatchVariables'.
* Add new 'useUnknownInCatchVariables' flag.
* Accepted baselines.
* Add test for catch variable explicitly typed as 'any'.
* Accepted baselines.
* Move option under 'strict'.
* Accepted baselines.
* 'useUnknownInCatchVariables' is strict in command line help.
2021-06-03 13:12:56 -07:00
Anders Hejlsberg
391f9ffb85
Strict optional properties ( #43947 )
...
* Introduce --strictOptionalProperties compiler switch
* Accept new baselines
* Removing missingType when printing back optional properties
* Accept new baselines
* Fix linting issue
* Use getNonMissingTypeOfSymbol in getTypeOfSymbolAtLocation
* Properly elaborate errors involving optional properties
* Accept new baselines
* Properly check optional properties in tuple types
* Accept new baselines
* Add missing tuple type check
* More permissive check of strict optional properties and index signatures
* Add tests
* Fix lint issues
* Accept new baselines
2021-06-01 14:52:16 -07:00
Ryan Cavanaugh
4c018818c1
Add a testcase that fails when someone tried to make an Object.keys PR ( #44368 )
2021-06-01 10:58:59 -07:00
Wesley Wigham
09a21ce7c6
Consider inferences between mapped type templates lower priority ( #44126 )
2021-05-28 21:07:39 -07:00
Anders Hejlsberg
9aa50d6475
Fix unintended 'as const' name lookup error ( #44311 )
...
* Fix logic for methods in isTypeParameterPossiblyReferenced
* Add regression tests
2021-05-27 17:23:28 -07:00
Anders Hejlsberg
3938958d36
Properly remove generic types that are constrained to 'null | undefined' in getNonNullableType ( #44219 )
...
* Improve getNonNullableType function
* Add tests
* More closely match previous behavior
* Add non-strict mode test
2021-05-25 11:40:28 -07:00
Zzzen
0e1df66a7c
don't duplicate function properties when emiting definitions of overload signatures ( #44235 )
2021-05-24 15:52:40 -07:00
Wesley Wigham
2203228b62
Ensure static index signatures have an errorNode available ( #44129 )
...
* Ensure static index signatures have an errorNode available
* Lookup static index signature declarations in the right symbol table, stop checking prototype props
2021-05-24 14:30:59 -07:00
Zzzen
756392c1f5
support QualifiedName when narrowing inside loops ( #43592 )
...
* support QualifiedName when narrowing inside loops
* add test
* narrow more qualified names
* handle `undefined` of `getFlowCacheKey `
* update comments in test
2021-05-21 10:36:54 -07:00
Nathan Shively-Sanders
71cdf6a920
Private identifiers use standard identifier scanning ( #44184 )
...
* Private identifiers use standard identifer scanning
Previously they used an old copy of the identifier scanning code that
didn't handle extended unicode yet.
* gotta fix that const lint
2021-05-20 14:39:31 -07:00
Jesse Trinity
5770434891
Revert #43460 and #40884 ( #44175 )
...
* Revert "Only issue matching token errors on non-dupe locations (#43460 )"
This reverts commit 76a2ae3d69e7eba33890d65159ee66719c69b916.
* Revert "Adding Diagnostic message for missing ']' and ')' in Array literal and conditional statements (#40884 )"
This reverts commit 555ef73da88a9316a5769b9329eb01f7ac0fc92b.
* re-add clobbered merge lines
2021-05-19 16:54:07 -07:00
Matas Rastenis
fde2c55652
fix(43799): Support bigint type for Intl.NumberFormat.formatToParts ( #44015 )
...
* Add bigint support for formatToParts
* Add tests for Intl.NumberFormat.formatToParts
* Cleanup test
* Fix EOL symbols
* Update baseline test
2021-05-18 17:05:18 -07:00
Wesley Wigham
f414d13679
Dont allow generic narrowing when contextually typed by a binding pattern ( #44081 )
2021-05-13 16:51:52 -07:00
Wesley Wigham
f7a97b7759
Cache accessibe symbol chains and serialized type parameter name generation ( #43973 )
...
* Cache accessibe symbol chains, type parameter name generation
* Move signature declaration helper length approximation to start of function
* Add node result caching internal to `typeToTypeNodeHelper`
* Suggestion from PR
2021-05-12 12:11:20 -07:00
Eli Barzilay
0454ae4720
Loosen up the first argument type for String.raw
...
The [String.raw spec](https://tc39.es/ecma262/#sec-string.raw ) uses just
the `raw` property of its first argument, which is a useful way of using
it in user-defined tag functions to do the work of interleaving strings
and values as well as converting the values to strings.
Fixes #43609 .
2021-05-12 14:13:26 -04:00
Anders Hejlsberg
42f0cf6ffc
Don't eagerly get apparent type of spread expression contextual type ( #44002 )
...
* Don't get apparent type of contextual type for spread expressions
* Add regression test
2021-05-07 15:44:17 -07:00
Nathan Shively-Sanders
71f338bad6
Revert "typeRelatedToSomeType passes through intersectionState ( #43707 )" ( #43983 )
...
This reverts commit db09cb595195d4eaa5dde0322c5a8fbb5f4b66d2.
2021-05-06 13:12:36 -07:00
Wesley Wigham
a5607a4eab
Dont allow namespace reexport symbols when looking up valid local names ( #43969 )
2021-05-06 12:03:48 -07:00
Wesley Wigham
456806b070
Allow filterType to consider union constraints of non-union types when determining never-ness ( #43763 )
...
* Allow filterType to consider union constraints of non-union types when determining never-ness
* Move impl to callback
* Baseline change in narrowing behavior into test, fix post-LKG build
2021-05-05 13:35:09 -07:00
Wesley Wigham
b83148fe64
Unwrap substitutions on conditional check types before comparing them ( #43888 )
2021-05-05 13:33:45 -07:00
Sheetal Nandi
54096bdb96
Use project relative preference for declaration emit ( #42232 )
...
* Test where relative import isnt ideal in the declaration emit
* use project relative preference for declaration emit
Fixes #39117
* Fix incorrect path matching when calculating module specifier
* Use correct baseUrl for the module specifier
2021-04-30 13:22:05 -07:00
Nathan Shively-Sanders
db09cb5951
typeRelatedToSomeType passes through intersectionState ( #43707 )
...
* typeRelatedToSomeType passes through intersectionState
Previously it didn't, even though it should have.
* fix parameter name lint
2021-04-28 16:12:20 -07:00
Wesley Wigham
5e4fcfbfb6
Add instantiation rules for reverse mapped types ( #42449 )
...
* Add instantiation rules for reverse mapped types
* Add smaller example of same issue
2021-04-27 15:01:46 -07:00
Wesley Wigham
bbad560912
Refrain from attempting to perform parameter fixing on a generic signature multiple times ( #43835 )
...
* Refrain from attempting to perform parameter fixing on a generic signature multiple times
* Remove assertion
2021-04-27 10:49:27 -07:00
Erik Brinkman
4d4ea66a9c
update contextual discrimination to include omitted members ( #43633 )
...
This diff extends the types checked by
discriminateContextualTypeByObjectMembers and
discriminateContextualTypeByJSXAttributes to also include any optional
components in the type union.
fixes #41759 although it doesn't address the better error reporting for
their last repro, which I'm not sure how to address.
2021-04-24 14:26:29 -07:00
Wesley Wigham
dee4903f45
Compute dervied generic-ness for substitutions and create lower priority inferences for substitutes ( #43765 )
2021-04-23 15:51:05 -07:00
Andrew Branch
bd7d0f26b2
Don’t allow an object literal with a spread as a fallback for destructuring a property not present in all constituents ( #43783 )
...
* Add test
* Don’t allow an object literal with a spread as a fallback for destructuring a property not present in all constituents
2021-04-23 14:44:57 -07:00
Wesley Wigham
8ea4ec9496
Add infer T constraint inference rule matching up mapped type templates across check/extends types ( #43649 )
2021-04-21 12:49:02 -07:00
Wesley Wigham
7e4400b9c3
Stop checking getter/setter compatability twice ( #43741 )
...
* Stop checking getter/setter compatability twice
* Ensure modifier errors are still emitted on both accessors, accept modified baselines
2021-04-19 15:53:48 -07:00
Wesley Wigham
85c9d2cc89
Use faster, stricter prop type comparison when merging props in union prop creation ( #43696 )
...
* Use faster, stricter prop type comparison when merging props in union prop creation
* Be better at determining this usage in methods, accept baselines
* Small style change
2021-04-19 15:25:12 -07:00
Ryan Cavanaugh
b1ab2b98be
Wire up 'writing' parameter through protected derived class detection ( #43455 )
...
Fixes #43443
2021-04-19 09:20:21 -07:00
Wesley Wigham
3ab6809e38
Consider identical instances of the same symbol equivalent when creating union and intersection properties ( #43560 )
...
* Consider identical instances of the same symbol equivalent when creating union and intersection properties
* Also copy over mapper and type (if available) on cloned symbols
* Editorial feedback
2021-04-14 16:55:45 -07:00
Wesley Wigham
6c7c5e9ec2
Expand exception to contravariant constraint elision to all type variables ( #43599 )
...
* Expand exception to contravariant constraint elision to all type variables
* Comment update
2021-04-14 13:13:02 -07:00
Wesley Wigham
6002cff776
Trim indexed access and type variable constraint error output ( #43540 )
2021-04-13 13:13:32 -07:00
Andrew Branch
06a73655d0
Don’t error for missing await when promise is referenced in condition body ( #43593 )
2021-04-13 12:15:48 -07:00