32750 Commits

Author SHA1 Message Date
Mark Fulton
7901f351eb
fix(WeakMapConstructor): readonly iterable items (#43905)
like `MapConstructor`, `WeakMapConstructor` should support receiving `Iterable<readonly [K, V]>` instead of `Iterable<[K, V]>`; otherwise tuples creates with `as const`, etc. cannot be safely passed in without casts, etc.
2021-05-20 07:18:58 -07:00
Nathan Shively-Sanders
4a59b63f35
Error for abstract property with initialiser (#43615)
* Error for abstract property with initialiser

* remove stray LF

* update baselines
2021-05-20 07:18:18 -07:00
Eli Barzilay
5ca7983ebe Fix the code that checks for variadic signatures
This code looks strange, like there's a typo in it (eg, using `lists` in
the `parameterList` loop, etc) -- so I also refactored it a bit to look
more intentional.  The new format makes it clearer that `lists` is
checked once *outside* the loop, as well as the role of
`hasEffectiveRestParameter`.

The actual bug fix is checking `pList.length` in the new `isVariadic()`.

Fixes 41059.
2021-05-20 09:27:57 -04:00
TypeScript Bot
6de6daeb01 Update package-lock.json 2021-05-20 06:06:13 +00: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
Anders Hejlsberg
e67da8a748
Preserve generics in contextual types for rest arguments (#44122)
* Move all getIndexedAccessType flags to AccessFlags enum

* Preserve generics in contextual types for rest arguments

* Add regression test
2021-05-19 13:46:07 -07:00
Anders Hejlsberg
73736d9b84
Fix logic for determining whether to simplify keyof on mapped types (#44042)
* Fix logic for determining whether to simplify keyof on mapped types

* Add regression test

* Improve hasDistributiveNameType check

* Add more tests

* Address code review feedback

* Add more tests
2021-05-19 13:43:22 -07:00
TypeScript Bot
87c5b6a752 Update package-lock.json 2021-05-19 06:06:08 +00:00
Sang
811b1f696d
improve jsdoc for array fill methods (#43627) 2021-05-18 17:25:38 -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
Oleksandr T
3f9e724c9f
fix(43796): Sort @deprecated completions lower than others (#43880)
* fix(43796): sort deprecated completions lower than others

* Update src/services/completions.ts

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
2021-05-18 13:55:00 -07:00
Oleksandr T
db01e84700
feat(eslint): consistent-type-assertions (#43556) 2021-05-18 06:20:57 -07:00
Eli Barzilay
fc07ee2ad7 skipParenthesesUp() is exactly the same as walkUpParenthesizedExpressions()
Remove the former since the latter is based on the generel `walkUp()`.
2021-05-18 04:40:56 -04:00
TypeScript Bot
1c12eeecb8 Update package-lock.json 2021-05-18 06:06:26 +00:00
David Michon
9136bb13fe
Generate SourceMap mappings string using array of character codes and fewer String.fromCharCode calls (#44031)
* Test normal char code array for source mappings

* Limit buffer size, minor performance tweaks

* Always commit at exactly chunk size

Co-authored-by: David Michon <dmichon-msft@users.noreply.github.com>
2021-05-17 18:16:32 -07:00
Andrew Branch
271e069af3
Don’t offer import statement completions at from position (#44125)
* Don’t offer import statement completions at `from` position

* Set isGlobalCompletion to false, use indexOf lookup
2021-05-17 17:48:15 -07:00
Nathan Shively-Sanders
82cb50fa45
Simplify codeql github action (#44124)
The current action is failing with an error that recommends removing the
`git checkout HEAD^2` step.
2021-05-17 11:13:30 -07:00
TypeScript Bot
9eab33463c Update package-lock.json 2021-05-15 06:06:17 +00:00
Wesley Wigham
f414d13679
Dont allow generic narrowing when contextually typed by a binding pattern (#44081) 2021-05-13 16:51:52 -07:00
Ikko Ashimine
493ec4cc26
Fix typo in host.ts (#43930)
encounted -> encountered
2021-05-13 14:00:26 -07:00
TypeScript Bot
4990bd9293 Update package-lock.json 2021-05-13 06:06:26 +00: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
Oleksandr T
7aacd6b274
fix(43879): forbid async in the left hand in a for-of statement (#43886) 2021-05-12 06:11:08 -07:00
Oleksandr T
463c79440f
fix(43030): fix instantiated null/undefined type from JS initializer (#43933) 2021-05-11 15:57:16 -07:00
TypeScript Bot
bb6d8a716e Update package-lock.json 2021-05-11 06:06:01 +00:00
Daniel Rosenwasser
d662d94957
Bump version to 4.4. (#44028)
* Bump version to 4.4.

* Update Baselines and/or Applied Lint Fixes

Co-authored-by: TypeScript Bot <typescriptbot@microsoft.com>
2021-05-10 12:42:48 -07:00
Sheetal Nandi
182b6c90d6
Test for Update the type reference cache with correct project options (#44008)
* Test without change

* Update showing fix in #44004 works
2021-05-10 12:29:36 -07:00
TypeScript Bot
fc34fa0531 Update package-lock.json 2021-05-10 06:05:57 +00:00
Wenlu Wang
5b1e873b03
Update diagnostic message and quickfix for parameter property (#44010) 2021-05-08 23:22:20 -07:00
TypeScript Bot
31253984aa Update package-lock.json 2021-05-08 06:06:18 +00:00
Sheetal Nandi
e61d812cbb
Update the type reference cache with correct project options (#44004) 2021-05-07 16:58:41 -07: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
Ron Buckton
cb9cd898d1
Revert #35877 - fix receiver on calls of imported and exported functions (#43993) 2021-05-07 13:42:12 -07:00
Sheetal Nandi
e5395efe49
Add writeFile and customTransformers to build and buildReferences (#43984) 2021-05-07 12:13:17 -07:00
Nathan Shively-Sanders
44238717f1
Remove accidentally added file in baselines (#43998) 2021-05-07 12:05:52 -07:00
Orta Therox
6bb481c9d3
Support semantic highlights for JS files (#43992)
* Switches from never allowing semantic highlight on JS to only doing it if we have a valid source file

* Adds a way to test and validate that an arbitrary JS file gets semantic classification results

* Revert to just dropping the if statement
2021-05-07 20:02:26 +01:00
Sheetal Nandi
cfed79b7a2
Correctly use ownMap from module resolution cache (#43986)
* Test showing the moduleResolutionCache reset issue with tsc --b --w

* Fix incorrect usage of ownMap by making it function returning ownMap instead of constant value
2021-05-07 09:56:29 -07:00
Nathan Shively-Sanders
f6303652d2
Improve errors for incorrectly nested export default (#43967)
* Improve errors for incorrectly nested export default

The compiler and services don't handle incorrectly nested
`export default` well right now:

```ts
export = (x,y) => {
  export default { }
}
```

Asking for document highlights, find all references or quick info on
'export' or 'default' cause a crash. After the crash is fixed, the error
message is confusing and wrong: "An export assignment cannot be used outside a module."

This PR:

1. Skips document highlights for incorrectly nested export default.
2. Skips find all refs for incorrectly nested export default.
3. Switches the fallback binding for incorrectly nested export default
from Alias to Property. Neither is correct, but Property doesn't cause a
crash in alias resolution.
4. Improves the error message to reflect a post-ES module world, which
has export default and 'module' means 'ES module', not 'namespace'.

Fixes #40082 and the related bugs mentioned above.

* address PR comments
2021-05-07 08:09:38 -07:00
TypeScript Bot
ad6ca7ae2c Update package-lock.json 2021-05-07 06:05:59 +00:00
Andrew Casey
1ce15a4531
Fix perf regression from #42556 (#43949)
PR #42556 was a nice optimization that dramatically sped up comparisons of discriminated unions.  Unfortunately, the cost of determining whether a union is discriminated can be prohibitively high.  In particular, an internal team with a very large repo saw their type count double and their memory usage increase from 6GB to 9GB, breaking their build.  This changes splits the difference by not trying to compute the property types of intersection types - a notoriously slow operation.
2021-05-06 17:06:38 -07:00
Andrew Branch
96c48b746a
Fix package.json auto imports for pnpm without project references (#43892)
* Fix package.json auto imports for pnpm without project references

* Make property optional

* Revert unnecessary unnittest change

* Set symlinked files when setting symlinked directories

* Update `typeDirectiveIsEqualTo`

* Consider symlinks found during type reference directive resolution into `discoverProbableSymlinks`

* Rename `originalFileName` to `originalPath`, make internal
2021-05-06 14:51:30 -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
Sheetal Nandi
233f28ca27
When directory watcher is invoked with any file from node_modules package, invalidate for file paths in that package (#43974)
Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
2021-05-06 09:48:26 -07:00
Oleksandr T
e0d7703cf3
fix(43939): forbid converting getters to async/await (#43944) 2021-05-06 01:48:54 -07:00
Ikko Ashimine
97f5c62956
Fix typo in system.ts (#43895)
assigment -> assignment
2021-05-06 01:40:00 -07:00
TypeScript Bot
b8da22e6c3 Update package-lock.json 2021-05-06 06:05:58 +00: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