Commit graph

32154 commits

Author SHA1 Message Date
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
Orta Therox 6baa1bec64
Improve non-ambient class and function merge error (#44352)
* Improve non-ambient class and function merge error

* Update baselines

* Update tests

Co-authored-by: Austin Cummings <austin@austincummings.com>
2021-06-03 14:08:04 +01:00
Orta Therox 9d345e7734
Rename TSConfig option categories (#42514)
* Update the category descriptions for the tsconfig options

* Gets tests green

* Whitespace change

* Drop command line options from --init

* Go back to the old re-build baseline

* Fix numbers

* Remove formatting options from --showconfig

* Dpon't show output formatting changes in showConfig

* Update baselines

* Update baselines
2021-06-03 12:21:04 +01:00
TypeScript Bot d8e9f69519 Update package-lock.json 2021-06-03 06:36:35 +00:00
Sheetal Nandi d2516fa95b
Tsserver tests can be baselined (#44326)
* Tests to baseline tsserver instead of checking
Also ensures inferred and auto import projects have name per project service

* Log structureIsReused value

* more baselines
2021-06-02 11:22:01 -07:00
Isabel Duan 9c50cb925e
Fixes subset of bugs (three tests fixed) listed in issue #41974 (#44367)
* some fixes for 41974

* linted

* fixed todo messages for readability
2021-06-02 09:32:19 -07:00
TypeScript Bot df6e3af022 Update package-lock.json 2021-06-02 06:50:26 +00: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
Orta Therox b603a04eed
Switch references to master to main in the codebase + validating infra post-main migration (#44347)
* Update package.json

* Remove references to master in the codebase

* Add more master - main
2021-06-01 20:44:18 +01: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
TypeScript Bot 663b19fe4a Update package-lock.json 2021-05-29 06:38:18 +00:00
Wesley Wigham 09a21ce7c6
Consider inferences between mapped type templates lower priority (#44126) 2021-05-28 21:07:39 -07:00
Oleksandr T 1f4c8708c2
fix(44123): forbid convert to async for generator callbacks (#44147) 2021-05-28 14:42:09 -07:00
TypeScript Bot e34b2adcae Update package-lock.json 2021-05-28 06:32:26 +00: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
Sheetal Nandi 817e45d1c1
Dont update timestamps of output files if noEmit was specified (#44306)
* Add failing test for #44303

* Dont update timestamps of output files if noEmit was specified.
Fixes #44303
2021-05-27 17:09:30 -07:00
Wesley Wigham 7c31d97cbf
Move string trim methods from utilities to core (#44308) 2021-05-27 14:20:23 -07:00
Sheetal Nandi 8721dd06f1
Add type brands for fileId and fileIdListId (#44280) 2021-05-27 11:15:13 -07:00
Sheetal Nandi 6329a0df90
Add traces for module resolution reuse (#44282) 2021-05-27 11:14:12 -07:00
TypeScript Bot 5fde87135f Update package-lock.json 2021-05-27 06:20:37 +00:00
Sheetal Nandi 32323ce7fb
redirectsTarget is keyed with Path (#44278)
* redirectsTarget is keyed with Path

* sourceFileToPackageName to keyed with Path

* feedback
2021-05-26 16:50:14 -07:00
Andrew Branch b1eaf3e170
Ensure AutoImportProviderProject can share source files with main program (#44274)
* Ensure AutoImportProviderProject can share source files with main program

* Revert package-lock change

* Add back reclassified options
2021-05-26 16:47:40 -07:00
Sheetal Nandi 2ffd35de4d
More updates to program reuse with different option changes (#44276) 2021-05-26 15:57:43 -07:00
Sheetal Nandi 3442d311cf
Fix outFile check (#44277) 2021-05-26 15:57:30 -07:00
Sheetal Nandi 54fbeb511d
Use correct state when getting it from redirected program (#44275)
Eg. program can backup and restore state changing the state object and we want to release program on the correct one
This ensure program is released correctly when there are declaration emit errors during tsc --build
2021-05-26 15:31:26 -07:00
Oliver Joseph Ash 3e29397d74
fix(44249): JSX: "extract to constant" generates invalid code when using fragment syntax (#44252)
Fixes https://github.com/microsoft/TypeScript/issues/44249
2021-05-26 13:24:02 -07:00
Nathan Shively-Sanders 459bd19941
Add unqualified JSDoc member references (#44202)
* Add unqualified JSDoc member references

This allows unqualified references like:

```ts
class Zero {
 /** @param buddy Must be {@link D_HORSE} or {@link D_DOG}. */
 deploy(buddy: number) { }
 static D_HORSE = 1
 static D_DOG = 2
}
```

I surveyed @see and @link again to estimate how common this is. I found
a little over 200 uses, which is around 2%. Sorted by frequency, this
*is* the next feature on the list, along with the `module:` prefix.
So I think this is about the right point to stop adding code.

In this case, however, I liked most of the uses -- there were a lot
of deprecated functions that referenced a function just below, where it
would be wordy to qualify the name, but the reader would benefit from a
link.

Note that unqualified references do *not* work inside type or object
literals. The code I ended up with is quite complicated and I didn't
observe any uses in the wild.

Fixes #43595

* Remove type/object literal container check

Since they don't work anyway
2021-05-26 09:54:05 -07:00
Andrew Casey 3ffa245f07
Cache parsed path mapping patterns (#44078)
* Cache parsed path mapping patterns

If a project has many of them (e.g. 1800), parsing the patterns
repeatedly can take up a lot of time.

* Move cache to ConfigFileSpecs

* Inline constants

* Simplify cache access
2021-05-26 09:40:42 -07:00
TypeScript Bot ddd3cf9406 Update package-lock.json 2021-05-26 06:17:14 +00:00
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