TypeScript Bot
3f7ff15b5f
Update package-lock.json
2022-08-22 06:08:09 +00:00
Daniel Rosenwasser
76357ba802
Swap forEachChild to use a table of functions instead of a switch statement. ( #50225 )
...
* Swap `forEachChild` to use an array of functions instead of a `switch` statement.
* Let's see if 'new' changes anything.
* Co-locate each assignment into `forEachChildTable`.
* Try `push`ing undefined to create a packed Array.
* Try using an unconditional no-op function.
* `forEach` -> `forEachChildIn`
* Remove the optional chain if we are pre-filling with no-ops.
* Grab function directly to avoid possible `.call` overhead from downlevel emit.
* Swap to object literal.
* Lints and formatting.
2022-08-21 17:48:45 -07:00
Alex Hsu
38e91fb120
LEGO: Merge pull request 50389
...
LEGO: Merge pull request 50389
2022-08-21 03:07:27 -07:00
TypeScript Bot
7cab3459d2
Update package-lock.json
2022-08-21 06:07:14 +00:00
TypeScript Bot
50041bdc7d
Update package-lock.json
2022-08-20 06:06:43 +00:00
Jake Bailey
6cbb39ba8b
Re-caret dependencies so deps like eslint continue to be bumped ( #50368 )
2022-08-19 12:58:54 -07:00
Ron Buckton
284837d66b
Fixes for decorators property deprecations ( #50343 )
...
* Change type of deprecated 'decorators' property
* fix 'Invalid Arguments' error for create/update constructor in factory
* Update deprecation comments
* Make 'decorators' optional and 'undefined'
* Rename '_decorators' to 'illegalDecorators'
* Update baselines
2022-08-19 14:27:26 -04:00
Jake Bailey
ef88fbb8ab
Remove some unused deps and dead code ( #50367 )
2022-08-19 09:42:14 -07:00
Oleksandr T
5969ae9ef7
fix(50075): do not strip undefined from the function class properties ( #50169 )
2022-08-19 09:34:42 -07:00
Wesley Wigham
05d7d6bb12
Unify default import resolution across specifier target codepaths ( #49814 )
...
* Unify default import resolution across specifier target codepaths
* Use differing type aliases, per request
2022-08-19 02:25:41 -07:00
TypeScript Bot
cb63d461dd
Update package-lock.json
2022-08-19 06:07:20 +00:00
Sheetal Nandi
1f0f7c8246
If resolvedFileName differs with realPath only in casing use the resolvedFileName before realpath so that errors can be reported with forceConsistentCasingInFileNames ( #50364 )
...
* Add tests when realpath supresses the casing error
* Fix when real path results in value that differs only in case
Fixes #49470
* Comment
2022-08-18 14:51:46 -07:00
Kyℓe Hensel
ea36fb3d5f
mark Intl.LocalesArgument as readonly ( #50135 )
2022-08-18 14:38:41 -07:00
Ron Buckton
1592210673
Add a jump-table for visitEachChild ( #50266 )
...
* Add a jump-table for visitEachChild
* Name each visitor function for better stack traces
* Fix node tests and some minor cleanup
2022-08-18 15:03:17 -04:00
Daniel Rosenwasser
7bafbeae90
Add fourslash function for validating syntactic classification ( #50362 )
2022-08-18 11:28:08 -07:00
Jake Bailey
df25b77d0f
Run eslint at root, rather than on src and scripts individually ( #50327 )
2022-08-18 11:24:10 -07:00
Alex Hsu
42165a183a
LEGO: Merge pull request 50353
...
LEGO: Merge pull request 50353
2022-08-18 03:12:12 -07:00
Jake Bailey
66d8b95941
Ensure all scripts are checked, fix errors ( #50326 )
2022-08-17 16:42:50 -07:00
Alex Hsu
15f7b6f687
LEGO: Merge pull request 50337
...
LEGO: Merge pull request 50337
2022-08-17 03:02:07 -07:00
TypeScript Bot
745da27309
Update package-lock.json
2022-08-17 06:06:59 +00:00
DetachHead
3b80ddca21
fix first match in RegExpMatchArray being possibly undefined when noUncheckedIndexedAccess is enabled ( #49682 )
...
* fix first match in `RegExpMatchArray` being possibly undefined when `noUncheckedIndexedAccess` is enabled
* fix tests
* add test
Co-authored-by: DetachHead <detachhead@users.noreply.github.com>
Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2022-08-16 10:12:12 -07:00
Andrew Branch
330e33cdda
Ignore related info in diagnostic deduplication ( #50309 )
...
* Ignore related info in diagnostic deduplication
* Add another test
2022-08-16 09:28:59 -07:00
Babak K. Shandiz
f24f74eb89
🔨 Fix missing "Implement interface" code fix for mapped types with implicit keyof T in their definition ( #49999 )
...
* ⚗️ Add test to verify code fix works when implementing a mapped type with indirect keyof
Signed-off-by: Babak K. Shandiz <babak.k.shandiz@gmail.com>
* 🔨 Add property as implementation for symbols that has no declaration
Signed-off-by: Babak K. Shandiz <babak.k.shandiz@gmail.com>
diff --git a/src/services/codefixes/helpers.ts b/src/services/codefixes/helpers.ts
index 94b64e57..a4c11fd5 100644
--- a/src/services/codefixes/helpers.ts
+++ b/src/services/codefixes/helpers.ts
@@ -60,21 +60,19 @@ namespace ts.codefix {
isAmbient = false,
): void {
const declarations = symbol.getDeclarations();
- if (!(declarations && declarations.length)) {
- return undefined;
- }
+ const declaration = declarations ? declarations[0] : undefined;
const checker = context.program.getTypeChecker();
const scriptTarget = getEmitScriptTarget(context.program.getCompilerOptions());
- const declaration = declarations[0];
+ const kind = declaration?.kind ?? SyntaxKind.PropertySignature;
const name = getSynthesizedDeepClone(getNameOfDeclaration(declaration), /*includeTrivia*/ false) as PropertyName;
- const visibilityModifier = createVisibilityModifier(getEffectiveModifierFlags(declaration));
+ const visibilityModifier = createVisibilityModifier(declaration ? getEffectiveModifierFlags(declaration) : ModifierFlags.None);
const modifiers = visibilityModifier ? factory.createNodeArray([visibilityModifier]) : undefined;
const type = checker.getWidenedType(checker.getTypeOfSymbolAtLocation(symbol, enclosingDeclaration));
const optional = !!(symbol.flags & SymbolFlags.Optional);
const ambient = !!(enclosingDeclaration.flags & NodeFlags.Ambient) || isAmbient;
const quotePreference = getQuotePreference(sourceFile, preferences);
- switch (declaration.kind) {
+ switch (kind) {
case SyntaxKind.PropertySignature:
case SyntaxKind.PropertyDeclaration:
const flags = quotePreference === QuotePreference.Single ? NodeBuilderFlags.UseSingleQuotesForStringLiteralType : undefined;
@@ -88,13 +86,16 @@ namespace ts.codefix {
}
addClassElement(factory.createPropertyDeclaration(
modifiers,
- name,
+ declaration ? name : symbol.getName(),
optional && (preserveOptional & PreserveOptionalFlags.Property) ? factory.createToken(SyntaxKind.QuestionToken) : undefined,
typeNode,
/*initializer*/ undefined));
break;
case SyntaxKind.GetAccessor:
case SyntaxKind.SetAccessor: {
+ if (!declarations) {
+ break;
+ }
let typeNode = checker.typeToTypeNode(type, enclosingDeclaration, /*flags*/ undefined, getNoopSymbolTrackerWithResolver(context));
const allAccessors = getAllAccessorDeclarations(declarations, declaration as AccessorDeclaration);
const orderedAccessors = allAccessors.secondAccessor
@@ -138,6 +139,10 @@ namespace ts.codefix {
// If there is more than one overload but no implementation signature
// (eg: an abstract method or interface declaration), there is a 1-1
// correspondence of declarations and signatures.
+ if (!declarations) {
+ break;
+ }
+
const signatures = checker.getSignaturesOfType(type, SignatureKind.Call);
if (!some(signatures)) {
break;
* 🔨 Improve code readability
Signed-off-by: Babak K. Shandiz <babak.k.shandiz@gmail.com>
diff --git a/src/services/codefixes/helpers.ts b/src/services/codefixes/helpers.ts
index 2f5c8703ab..aea0206a8a 100644
--- a/src/services/codefixes/helpers.ts
+++ b/src/services/codefixes/helpers.ts
@@ -60,7 +60,7 @@ namespace ts.codefix {
isAmbient = false,
): void {
const declarations = symbol.getDeclarations();
- const declaration = declarations ? declarations[0] : undefined;
+ const declaration = declarations?.[0];
const checker = context.program.getTypeChecker();
const scriptTarget = getEmitScriptTarget(context.program.getCompilerOptions());
const kind = declaration?.kind ?? SyntaxKind.PropertySignature;
@@ -93,9 +93,7 @@ namespace ts.codefix {
break;
case SyntaxKind.GetAccessor:
case SyntaxKind.SetAccessor: {
- if (!declarations) {
- break;
- }
+ Debug.assertIsDefined(declarations);
let typeNode = checker.typeToTypeNode(type, enclosingDeclaration, /*flags*/ undefined, getNoopSymbolTrackerWithResolver(context));
const allAccessors = getAllAccessorDeclarations(declarations, declaration as AccessorDeclaration);
const orderedAccessors = allAccessors.secondAccessor
@@ -139,10 +137,7 @@ namespace ts.codefix {
// If there is more than one overload but no implementation signature
// (eg: an abstract method or interface declaration), there is a 1-1
// correspondence of declarations and signatures.
- if (!declarations) {
- break;
- }
-
+ Debug.assertIsDefined(declarations);
const signatures = type.isUnion() ? flatMap(type.types, t => t.getCallSignatures()) : type.getCallSignatures();
if (!some(signatures)) {
break;
* 📜 Add comment regarding mapped type children's missing declaration
Signed-off-by: Babak K. Shandiz <babak.k.shandiz@gmail.com>
Signed-off-by: Babak K. Shandiz <babak.k.shandiz@gmail.com>
Co-authored-by: Andrew Branch <andrew@wheream.io>
2022-08-16 09:27:29 -07:00
Andrew Branch
90fa1c70c1
Update baseline after out-of-order merge ( #50320 )
2022-08-16 08:54:55 -07:00
TypeScript Bot
9767f51758
Update package-lock.json
2022-08-16 06:06:30 +00:00
Andrew Branch
4e33e0eb6c
Make literal types not comparable to weak object types without property overlap ( #49865 )
2022-08-15 17:10:11 -07:00
Andrew Branch
64ee1e88e0
Strip literal freshness of contextually typed literals ( #49884 )
...
* Strip literal freshness of contextually typed literals
* Add more tests
2022-08-15 17:04:09 -07:00
Sheetal Nandi
9c1baeede6
On windows handle the long paths in realpathSync.native ( #50306 )
...
Fixes #49470
2022-08-15 16:57:47 -07:00
Wesley Wigham
e989d840f1
Forward intersectionState flag when comparing indexed access constraints ( #50261 )
2022-08-15 16:10:32 -07:00
Nicolas Rodriguez
8a873de5cf
fix(49149): remove unneeded array overload to Object.freeze ( #50029 )
...
* fix(49149): remove unneeded array overload to Object.freeze
* chore: commit baseline changes
Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
Co-authored-by: Andrew Branch <andrew@wheream.io>
2022-08-15 16:10:02 -07:00
Oleksandr T
61d8a8d7f3
fix(49629): fix crash in find-all-refs when using module.exports/export= with arrays/primitives ( #50291 )
2022-08-15 15:14:26 -07:00
Andrew Branch
bc52ff6f4b
Make React import fix not block component import fix ( #50307 )
...
* Stop React import fix from blocking component import fixes
* Add additional promote-type-only test
2022-08-15 13:13:41 -07:00
Jake Bailey
fd3c46b2f0
Fix export = error message to not have redundant language ( #50308 )
2022-08-15 13:13:33 -07:00
Jake Bailey
9f7c0cbad7
Run ESLint over our JS files, fix all lints ( #50172 )
2022-08-15 08:42:26 -07:00
Alex Hsu
03b12a6a45
LEGO: Merge pull request 50298
...
LEGO: Merge pull request 50298
2022-08-14 03:10:53 -07:00
TypeScript Bot
656d6a57d2
Update package-lock.json
2022-08-14 06:06:50 +00:00
Alex Hsu
7f5600eec5
LEGO: Merge pull request 50295
...
LEGO: Merge pull request 50295
2022-08-13 05:07:02 -07:00
Ryan Cavanaugh
adf26ffa4b
Revert "Fixed an issue with contextual type for intersection properties ( #48668 )" ( #50279 )
...
This reverts commit 9236e39374c0ec9a1e3f9894af4fb9eb34ba0021.
2022-08-12 10:24:50 -07:00
TypeScript Bot
8783da8726
Update package-lock.json
2022-08-12 06:06:46 +00:00
Sheetal Nandi
b19741c65d
Report aggregate statistics for solution as well as some solution perf numbers ( #50267 )
...
* Report aggregate statistics for solution as well as some solution perf numbers
This change under --extendedDiagnostics aggregates the diagnostics from all projects built and reports it at the end. Apart from that it also outputs some measurements for work that happens in tsc --build like finding if projects are uptodate etc.
Also removes unnecessary node count per suggestion
* Apply suggestions from code review
Co-authored-by: Ron Buckton <ron.buckton@microsoft.com>
* Fix condition
* Remove extra time
Co-authored-by: Ron Buckton <ron.buckton@microsoft.com>
2022-08-11 13:20:48 -07:00
Jack Works
075ee3d4b6
refactor: follow gh-50257 JSX.IntrinsicClassAttributes logic ( #50271 )
2022-08-11 09:32:31 -07:00
TypeScript Bot
9189e42b1c
Update package-lock.json
2022-08-11 06:06:47 +00:00
Jack Works
e2fbe19adf
fix: produceLKG does not work on Windows ( #50140 )
2022-08-10 20:12:17 -07:00
Sheetal Nandi
924c68ca95
use cache for program creation on watch mode. ( #49958 )
2022-08-10 16:56:54 -07:00
Sheetal Nandi
90cfbaee37
Make build info tolerant to json errors ( #50265 )
...
* Make build info tolerant to json errors
Fixes #49754
* Fix incorrect code
2022-08-10 16:44:35 -07:00
Jake Bailey
8a24fe75c9
Fix up code so we don't crash when TS itself is emitted with let/const ( #50151 )
2022-08-10 13:38:38 -07:00
Jake Bailey
b56483feb8
Remove shims project ( #50049 )
2022-08-10 11:49:59 -07:00
Jake Bailey
7f1dc78f54
Simplify normalizeSlashes ( #50154 )
2022-08-10 11:20:00 -07:00
Jake Bailey
5fbf3b04dc
Don't treat object properties as potential JS contructors without JSDoc class tag ( #49735 )
2022-08-10 11:19:19 -07:00
Jack Works
382f0c3af3
fix: crashes when JSX.IntrinsicClassAttributes is an alias type close GH-50254 ( #50257 )
2022-08-10 10:41:12 -07:00