Commit Graph

24305 Commits

Author SHA1 Message Date
Ryan Cavanaugh
af027f34fa Bail on 0- and 1-length lists in removeSubtypes to avoid spurious circularity problems (#46981)
* Creates a reasonable workaround for #46939

* Remove unrelated newline

* Do the cheap length check ahead of the cache check

* Actually do it.
2022-03-08 08:50:07 -08:00
Jake Bailey
d8b21a8d6c Don't crash on non-literal computed property names during getPropertyAssignment (#48079) 2022-03-07 14:18:55 -08:00
Andrew Casey
418989b3c3 Tidy up navto and find-file-references (#48106)
They were using the same helpers as FAR and rename, but they actually behave differently.  Decoupling them helps avoid some unnecessary work and will make it easier to clean up FAR in the future.

Scoping NavTo results to a single project (rather than, e.g. all loaded projects) makes the behavior more logical and the implementation simpler.
2022-03-07 10:56:04 -08:00
csigs
20c93d3b1d LEGO: Merge pull request 48129
LEGO: Merge pull request 48129
2022-03-05 02:50:20 -08:00
jihndai
5f6ebf9d78 Show error when trying to instantiate a union of abstract and concrete constructors (#48114)
* check composite signatures for abstract flag

* add tests and baselines

* refactor someSignature into a single function
2022-03-04 17:39:05 -08:00
jihndai
857889a4e6 Fix crash when this is typed as a generic T with no type constraints (#47991)
* fix this type validations for protected fields

* update previous baselines

* add new tests and baselines

* ClassOrInterface can be returned as enclosingClass

* inline function code and remove unnecessary blank lines

* refactor enclosingClass checks
2022-03-04 17:08:44 -08:00
Oleksandr T
82fc9b19ba fix(43154): emit typeof type for static methods with a computed name (#46923) 2022-03-04 17:07:38 -08:00
Jack Bates
d12020d8b0 Describe jsxFragmentFactory option default value (#46798) 2022-03-04 17:03:55 -08:00
Oleksandr T
162713fac9 fix(40617): handle uninitialized class member with computed key (#45974) 2022-03-04 16:03:36 -08:00
Zzzen
f9ae305dda support generic type when checking implicit conversion of symbol to string (#44578)
Co-authored-by: Wesley Wigham <wewigham@microsoft.com>
2022-03-04 15:57:34 -08:00
Erik Brinkman
751c114126 Fix contextual discrimination for omitted members (#43937)
In short, the fix I submitted looked at the union ofproperties, but it
really should have looked at the intersection.

Two sytlistic notes. I couldn't find the best way to get the unique
strings of an array like `[...new Set()]` would, so I created a small
helper function, but didn't put it in a great place. Also, before the
second concatenated array of discriminators at least matched the first
in complexity, but now it's much worse. I don't think that section is
particularly easy to read, but I also don't see a significantly reusable
part.

fixes #41759
2022-03-04 14:07:37 -08:00
liewrichmond
ae62da9413 Fixes #35735: Avoids listing missing properties for types with only call/construct signatures (#40973)
* Fixes #35735

* fixes #35735

* PR feedback

Co-authored-by: Wesley Wigham <wewigham@microsoft.com>
2022-03-04 13:54:38 -08:00
Oleksandr T
5f9f9e3752 fix(44477): emit full path to access expressions in comments (#44545)
Co-authored-by: Wesley Wigham <wewigham@microsoft.com>
2022-03-04 11:22:46 -08:00
Jake Bailey
4abad556be Prevent crash on code fixes on default keyword (#48028) 2022-03-04 10:43:04 -08:00
jihndai
1f52ca8441 Require tag parameter and allow Locale object as argument to Intl.Locale() constructor (#48019)
* mark tag as required, and can accept another Locale object

* add tests and baselines

* update baselines
2022-03-04 09:04:57 -08:00
csigs
39013f1a78 LEGO: Merge pull request 48119
LEGO: Merge pull request 48119
2022-03-04 02:50:09 -08:00
Wesley Wigham
ddad61e1b0 Add an overload to Object.freeze that preserves literal types (#33767)
* Add an overload to Object.freeze that preserves literal types

* Accept changes baselines

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2022-03-03 14:23:41 -08:00
PaulHan
0a24dee97d fix: add this type for Reflect.defineProperty (#33544)
Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2022-03-03 11:01:12 -08:00
magic-akari
06d426c966 Fix const enum comments (#47990)
* chore: add test case

* fix: const enum comment

* fix: replace all unsafe pattern

* chore: run regex only if element access
2022-03-03 09:10:02 -08:00
Wesley Wigham
f82d0cb329 Add explicit assertion on somewhat commonly incorrectly passed argument (#48078)
* Add explicit assertion on somewhat commonly incorrectly passed argument

* PR feedback
2022-03-02 09:13:42 -08:00
Wesley Wigham
ea0db9e031 Add import assertions to type only imports and import types to force the resolution mode of the specifier (#47807)
* Add import assertions for type-only imports and import types to change resolver modes

* By popular request, only allow mode assertions on top-level type only imports

* Add specifier options parameter to specifier generation
2022-03-02 08:54:10 -08:00
Wesley Wigham
ff1f7b15b7 Esm imports of cjs files should unconditionally have a default patched on (#48062) 2022-03-02 08:53:31 -08:00
Oleksandr T
063714886e fix(47946): check literal types in export assignments with declared JSDoc types (#47951) 2022-03-01 14:44:36 -08:00
Gabriela Araujo Britto
e64f04bd8c Fix modifier order for class member completions (#48066)
* fix modifier order & tests

* remove empty replacement span from tests
2022-03-01 10:05:24 -08:00
Jake Bailey
e4fe50cca4 Fix incorrect parser error assumption in semicolon handling leading to incremental parser brokenness (#48067) 2022-02-28 17:05:32 -08:00
Wesley Wigham
71918750f9 Use full isReadonlySymbol check rather than declaration flags (#48064)
* Use full `isReadonlySymbol` check rather than declaration flags

* Limit subtype readonly consistency check to strict subtype relation

* Update comment
2022-02-28 14:35:33 -08:00
jihndai
1abc47b882 Add Intl.Locale parameter type to toLocale[X]String signatures. (#47811)
* add Intl.Locale param type to locales argument in BigInt, Number, and Date methods

* update baselines

* add test for locales object arguments

* fix indentation
2022-02-28 14:10:18 -08:00
Wesley Wigham
03c11c8f70 Add missing getReducedType call in getConditionalTypeInstantiation (#48061) 2022-02-28 13:41:10 -08:00
Zzzen
41b981c998 fix(47853): Convert to template string issue (#47976) 2022-02-28 10:40:48 -08:00
Nobuyuki Tsutsui
0043abe982 Expose text property of SourceFileLike for some Public APIs (#44599)
* Expose text property of SourceFileLike

* gulp baseline-accept
2022-02-25 14:29:08 -08:00
Jake Bailey
2dede207ae Don't treat a colon in a conditional expression branch as part of an arrow function (#47550) 2022-02-25 13:08:18 -08:00
Zzzen
dda65830de go-to-type-definition, and find-all-refs should work for import.meta (#44364)
* go-to-type-definition, and find-all-refs should work for import.meta

* search `meta` instead of `import.meta`

* remove `definition`

* fix compilation error

* update baseline

* revert definition
2022-02-25 09:02:06 -08:00
Gabriela Araujo Britto
733eff2b10 Revert "Use related spans for "implement abstract class" errors" (#48029) 2022-02-24 16:15:31 -08:00
Gabriela Araujo Britto
4b395c6097 Merge branch 'related-spans-for-implement-abstract-class-error' of https://github.com/FlyingPumba/TypeScript into FlyingPumba-related-spans-for-implement-abstract-class-error 2022-02-24 16:11:03 -08:00
islandryu
ff3b458714 fix(47158): Removes comments when line variable declaration (#47407)
Co-authored-by: Jake Bailey <5341706+jakebailey@users.noreply.github.com>
2022-02-23 09:33:41 -08:00
Gabriela Araujo Britto
78818e0390 early return if pattern type is never (#47927) 2022-02-22 17:34:02 -08:00
Oleksandr T
aa920c00f2 fix(47296): add outlining spans for parenthesized expressions (#47307) 2022-02-22 12:12:12 -08:00
csigs
8f9b65318f LEGO: Merge pull request 47985
LEGO: Merge pull request 47985
2022-02-21 02:54:45 -08:00
csigs
a7548745d7 LEGO: Merge pull request 47973
LEGO: Merge pull request 47973
2022-02-20 02:50:12 -08:00
csigs
1ad569fa3d LEGO: Merge pull request 47967
LEGO: Merge pull request 47967
2022-02-19 03:09:46 -08:00
Nathan Shively-Sanders
5150682a58 Only suggest @param codefixes in TS (#47959)
* Only issue @param suggestions with codefixes in TS

Previously, there were 2 JS errors that were issued as suggestions in TS
files. But there was no codefix for these errors, and the errors were
incorrect in TS.

This PR only issues the JS-specific errors on JS files.

* Minimise test
2022-02-18 15:58:09 -08:00
Oleksandr T
b0b8cdafc9 feat(44956): remove hyphen separator (#47777) 2022-02-18 13:41:36 -08:00
Nathan Shively-Sanders
2477ff915e Fix object.assign first param constraint (#40909)
* fixes #35621

* undo changes to generated file

* undo whitespace fixup attempt

* update baselines

Co-authored-by: TrejGun <trejgun@gmail.com>
2022-02-18 13:30:07 -08:00
Josh Goldberg
92204983f4 Standardized aka.ms links for tsc and tsconfig (#47129)
* Standardized aka.ms links for tsc and tsconfig

* Three missed baselines

* Three last baselines

* Went back to aka.ms/tsconfig
2022-02-18 12:09:15 -08:00
Anders Hejlsberg
db226a80e8 Remove unnecessary check in getNarrowableTypeForReference (#47953)
* Remove unnecessary check in getNarrowableTypeForReference

* Add regression test
2022-02-18 11:03:48 -08:00
csigs
ddf17e0a76 LEGO: Merge pull request 47948
LEGO: Merge pull request 47948
2022-02-18 02:49:24 -08:00
islandryu
b8b1201e44 fix(47024):fix type of DateTimeFormat and NumberFormat (#47117)
* fix type of DateTimeFormat and NumberFormat

* add NumberFormat to esnext.intl.d.ts

* Update src/lib/esnext.intl.d.ts

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>

* better unification of previous changes

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2022-02-17 15:37:43 -08:00
Oleksandr T
51d34466e7 feat(47281): use unknown type instead of any (#47308) 2022-02-17 13:54:02 -08:00
Matt Bierner
55e2e15aa3 Use webworker typings for webServer (#46944)
Updates `webServer.ts` to include the webworker typings. This means we don't have to redeclare the web globals we use in this file
2022-02-17 13:18:20 -08:00
DetachHead
092018bd7e fix issue where duplicate default exports aren't detected (#46871)
* fix issue where duplicate default exports aren't detected when there's an interface

* accept baseline change

* add `exportDefaultInterfaceClassAndValue` test

* add more tests for multiple default exports

* add two interfaces test

Co-authored-by: DetachHead <detachhead@users.noreply.github.com>
2022-02-17 13:17:31 -08:00