Commit graph

32125 commits

Author SHA1 Message Date
Oleksandr T 4559855c64
feat(44190): check misspelled base members in override checks (#44213) 2021-05-25 21:24:28 -07:00
Sheetal Nandi b7b4856944
Refactor tsbuild watch tests (#44258) 2021-05-25 17:01:06 -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
Jujhar Singh 52cefdf79e
IntelliSense doc string.replace typo (#41385)
* Fix IntelliSense doc string.replace typo

* Update IntelliSense doc string.replace

* Update string.replace doc text

* Revert "Fix IntelliSense doc string.replace typo"

This reverts commit 4220ec8a94.

* Reworded string.replace doc text

* Fix doc string.replace text
2021-05-25 08:11:02 -07:00
Jujhar Singh 7a11b92cb1
IntelliSense doc string.replace typo (#41385)
* Fix IntelliSense doc string.replace typo

* Update IntelliSense doc string.replace

* Update string.replace doc text

* Revert "Fix IntelliSense doc string.replace typo"

This reverts commit 4220ec8a94.

* Reworded string.replace doc text

* Fix doc string.replace text
2021-05-25 08:10:14 -07:00
Jujhar Singh aa3ad4e2e2
IntelliSense doc string.replace typo (#41385)
* Fix IntelliSense doc string.replace typo

* Update IntelliSense doc string.replace

* Update string.replace doc text

* Revert "Fix IntelliSense doc string.replace typo"

This reverts commit 4220ec8a94.

* Reworded string.replace doc text

* Fix doc string.replace text
2021-05-25 08:06:08 -07:00
Jujhar Singh 98f04e224f
IntelliSense doc string.replace typo (#41385)
* Fix IntelliSense doc string.replace typo

* Update IntelliSense doc string.replace

* Update string.replace doc text

* Revert "Fix IntelliSense doc string.replace typo"

This reverts commit 4220ec8a94.

* Reworded string.replace doc text

* Fix doc string.replace text
2021-05-25 08:05:27 -07:00
TypeScript Bot 59e3a80234 Update package-lock.json 2021-05-25 06:13:11 +00: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 fcabb5c0cc
Simplify or optimize regexes with polynomial time worst cases (#44197)
* Simplify or optimize regexes with polynomial time worst cases

* PR feedback & cleanup

Co-authored-by: David Michon <dmichon-msft@users.noreply.github.com>

* Use builtin scanner function for checking whitespace in fallback method (its faster)

Co-authored-by: David Michon <dmichon-msft@users.noreply.github.com>
2021-05-24 15:28:52 -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
Eli Barzilay 58a6692ef0 Implement a two-way mirroring between the wiki and its public repo
Previously, changes to the wiki would get merged to the public repo in a
once-a-week action.  This significantly revises this, making the two
sides be mirrors (up to the few seconds it takes to do a merge).

This is driven by a minimal-ish yaml file in both sides (`TypeScript`
and `TypeScript-wiki`) that *always* works from the script in the public
repo.

The two action specs are nearly identical, but there are some differences:

  - On the main repo, trigger on a `gollum` event, and in the wiki repo
    the usual (pushes, schedule, manual).  (The schedule run is kept as
    a just-in-case, and it's now running twice a week.)
  - The filename is `sync-wiki` on the TS side and just `sync` in the
    wiki.  (Good to avoid confusion if both files somehow find
    themselves in the same neighborhood.)
  - The secret names are different since I used the name that already
    exists in each side.

The script does *not* start with a checkout of its repository.  Doing
this in the TS side would be redundant (it would get the TS tree) and
slow.  Instead, it's always cloning the public wiki repo (`DASHREMOTE`,
since its url is `.../TypeScript-wiki`) and then fetching into it the
repo of the rendered wiki (`DOTREMOTE`, with a `.../TypeScript.wiki`)
url.

Also revised the README, since they should always be mirrored with this
change, and therefore there is no "source of truth".
2021-05-24 16:14:42 -04:00
Nathan Shively-Sanders c4c6a83922
Add @linkcode and @linkplain tags (#44208)
* Add @linkcode and @linkplain tags

They are just like @link tags but request fixed-width and normal
presentation, respectively.

Fixes #43935

* revert JSDocComment -> JSDoc SyntaxKind rename

* update API baselines

* fix lint
2021-05-24 13:01:58 -07:00
Eli Barzilay fb5f855108 Avoid convertExport when there's a non-identifier or a bogus one
Fixes #44105
2021-05-24 14:24:36 -04:00
Andrew Casey 7954f0c947
Kick out of normalizePath if there's nothing to do (#44173)
* Kick out of normalizePath if there's nothing to do

...using `relativePathSegmentRegExp`.

Bonus: use a regex to handle "/./" to avoid splitting and joining in a
common case.

When building the compiler, for example, it looks like ~95% of arguments
to `normalizePath` do not require any normalization.

* Check normalization before and after . cleanup

* Also cleanup leading ./
2021-05-24 09:38:44 -07:00
ZYSzys eb7c1ada6f
fix: internal createSignature support undefined declaration (#44109) 2021-05-24 06:50:20 -07:00
TypeScript Bot 6df16b35f2 Update package-lock.json 2021-05-22 06:06:20 +00: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
Andrew Casey 14343bead8
Avoid calling replace in normalizeSlashes when it would do nothing (#44100)
* Make normalizeSlashes a no-op there are no bad slashes

On Windows, there will probably be a negligible slowdown, iterating over
the pre-slash prefix of each unnormalized path (though we might come out
ahead if paths are normalized more than once).

On *nix, this saves work - 1.8s -> 0.4s in the project I'm
investigating.

* Reuse already-computed index
2021-05-21 10:28:22 -07:00
Nathan Shively-Sanders 086423729a
Add jsdoc member names: Class#method (#44150)
* Everything mostly works

A couple of mixed, nested references don't work yet.
The scanner+parser interaction is wrong, the parser consumes one too
many spaces, and the checker+services code needs a little cleanup.

* Cleanup

1. I decided that correctly parsing a#b.c, an entity name containing an
instance reference, is not worth the work.
2. I made the scanner, at least the jsdoc part, emit a # token, and
provided a reScanPrivateIdentifier in order to convert #a to # a.
3. I cleaned up the code in the checker.
2. Unrelated: I added a missing space in linkPart display.

* Cleanup lint + var naming

* investigate+clean up a couple of TODOs

* Fix lint in utilities.ts

* change name to JSDocMemberName

* address PR comments
2021-05-21 07:53:17 -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
Ron Buckton 4ce12f9f65
Move class name capture for private state until after declaration evaluates (#44186) 2021-05-20 14:35:40 -07:00
Jean Pierre ab81bf734e
Fix regression no codefix for ts2657 (#43635)
* Fix regression no codefix for ts2657
Fixes #43454

* remove unnecessary check
2021-05-20 12:13:38 -07:00
Andrew Casey 87d0b3e07a
Correct path segment regex (#44149)
The old version incorrectly matched anything with a leading or trailing
slash.  The empty segment should only be detected between two slashes.
2021-05-20 10:54:15 -07:00
Nathan Shively-Sanders 89a737c871
Improve parser recovery for unclosed/mismatched JSX elements (#43780)
* First draft

Everything works, the error messages for unmatched opening elements
could still use improvement, plus there is tonnes of unused and ugly
code.

1. Make sure the parser can recover from all kinds of unclosed tags.
2. Improve the parse tree for unmatched opening tags.
3. Better errors at some point.

* Lots of cleanup

* Improve readability of construction/fix lint

* improve line-length formatting
2021-05-20 07:20:57 -07:00
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 76a2ae3d69.

* Revert "Adding Diagnostic message for missing ']' and ')' in Array literal and conditional statements (#40884)"

This reverts commit 555ef73da8.

* 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