tsc-ts 0.0.9 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/bin/tsc-ts.js +70 -1
- package/dist/api/compiler/ast-utilities.d.ts +19 -1
- package/dist/api/compiler/ast-utilities.js +180 -95
- package/dist/api/compiler/ast.d.ts +22 -15
- package/dist/api/compiler/ast.js +1026 -995
- package/dist/api/compiler/astnav.js +15 -15
- package/dist/api/compiler/binder-utilities.js +186 -186
- package/dist/api/compiler/binder.js +290 -263
- package/dist/api/compiler/character-codes.js +2 -2
- package/dist/api/compiler/checker-calls.js +178 -124
- package/dist/api/compiler/checker-classes.d.ts +14 -3
- package/dist/api/compiler/checker-classes.js +134 -90
- package/dist/api/compiler/checker-contextual.js +64 -61
- package/dist/api/compiler/checker-declaration-order.js +79 -79
- package/dist/api/compiler/checker-declarations.d.ts +1 -0
- package/dist/api/compiler/checker-declarations.js +160 -136
- package/dist/api/compiler/checker-declared-types.js +67 -65
- package/dist/api/compiler/checker-decorators.js +77 -77
- package/dist/api/compiler/checker-deprecation.d.ts +8 -3
- package/dist/api/compiler/checker-deprecation.js +76 -55
- package/dist/api/compiler/checker-destructuring.js +47 -45
- package/dist/api/compiler/checker-elaboration.js +24 -24
- package/dist/api/compiler/checker-emit-helpers.js +4 -4
- package/dist/api/compiler/checker-emit-resolver.d.ts +4 -2
- package/dist/api/compiler/checker-emit-resolver.js +25 -13
- package/dist/api/compiler/checker-evaluator.js +9 -9
- package/dist/api/compiler/checker-expressions.js +244 -211
- package/dist/api/compiler/checker-functions.js +113 -107
- package/dist/api/compiler/checker-generated-code.d.ts +0 -11
- package/dist/api/compiler/checker-generated-code.js +28 -52
- package/dist/api/compiler/checker-grammar.d.ts +1 -0
- package/dist/api/compiler/checker-grammar.js +472 -440
- package/dist/api/compiler/checker-heritage.js +91 -93
- package/dist/api/compiler/checker-inference.d.ts +77 -5
- package/dist/api/compiler/checker-inference.js +487 -107
- package/dist/api/compiler/checker-iteration.d.ts +0 -10
- package/dist/api/compiler/checker-iteration.js +35 -52
- package/dist/api/compiler/checker-javascript.js +14 -14
- package/dist/api/compiler/checker-jsdoc.d.ts +8 -10
- package/dist/api/compiler/checker-jsdoc.js +67 -58
- package/dist/api/compiler/checker-jsx.js +105 -88
- package/dist/api/compiler/checker-members.d.ts +9 -2
- package/dist/api/compiler/checker-members.js +212 -75
- package/dist/api/compiler/checker-modules.d.ts +15 -6
- package/dist/api/compiler/checker-modules.js +469 -309
- package/dist/api/compiler/checker-narrowing.js +273 -189
- package/dist/api/compiler/checker-object-literals.js +25 -22
- package/dist/api/compiler/checker-operators.js +126 -118
- package/dist/api/compiler/checker-overloads.js +27 -27
- package/dist/api/compiler/checker-property-access.js +59 -55
- package/dist/api/compiler/checker-services.d.ts +1 -0
- package/dist/api/compiler/checker-services.js +222 -210
- package/dist/api/compiler/checker-signatures.js +65 -49
- package/dist/api/compiler/checker-source-file.d.ts +5 -0
- package/dist/api/compiler/checker-source-file.js +154 -130
- package/dist/api/compiler/checker-statements.js +33 -32
- package/dist/api/compiler/checker-super.js +50 -50
- package/dist/api/compiler/checker-symbol-types.js +109 -93
- package/dist/api/compiler/checker-symbols.d.ts +13 -1
- package/dist/api/compiler/checker-symbols.js +264 -149
- package/dist/api/compiler/checker-type-factory.d.ts +5 -0
- package/dist/api/compiler/checker-type-factory.js +145 -36
- package/dist/api/compiler/checker-type-nodes.d.ts +1 -0
- package/dist/api/compiler/checker-type-nodes.js +179 -141
- package/dist/api/compiler/checker-type-operators.d.ts +2 -0
- package/dist/api/compiler/checker-type-operators.js +110 -63
- package/dist/api/compiler/checker-types.d.ts +80 -3
- package/dist/api/compiler/checker-types.js +121 -2
- package/dist/api/compiler/checker-unused.js +114 -118
- package/dist/api/compiler/checker-utilities.js +11 -11
- package/dist/api/compiler/checker.d.ts +104 -31
- package/dist/api/compiler/checker.js +181 -33
- package/dist/api/compiler/command-line.d.ts +1 -3
- package/dist/api/compiler/command-line.js +47 -44
- package/dist/api/compiler/compile-program.d.ts +42 -3
- package/dist/api/compiler/compile-program.js +139 -27
- package/dist/api/compiler/diagnostic-messages.d.ts +1849 -1774
- package/dist/api/compiler/diagnostic-messages.js +128 -122
- package/dist/api/compiler/diagnostics.d.ts +22 -0
- package/dist/api/compiler/diagnostics.js +93 -11
- package/dist/api/compiler/emitter.d.ts +7 -1
- package/dist/api/compiler/emitter.js +53 -11
- package/dist/api/compiler/file-include.d.ts +2 -1
- package/dist/api/compiler/file-include.js +11 -7
- package/dist/api/compiler/file-loader.d.ts +21 -1
- package/dist/api/compiler/file-loader.js +201 -48
- package/dist/api/compiler/instantiation.d.ts +7 -0
- package/dist/api/compiler/instantiation.js +101 -49
- package/dist/api/compiler/jsdoc.js +23 -23
- package/dist/api/compiler/link-tables.d.ts +48 -18
- package/dist/api/compiler/link-tables.js +80 -37
- package/dist/api/compiler/locales/cs-CZ.d.ts +1 -1
- package/dist/api/compiler/locales/cs-CZ.js +1 -1
- package/dist/api/compiler/locales/de-DE.d.ts +1 -1
- package/dist/api/compiler/locales/de-DE.js +1 -1
- package/dist/api/compiler/locales/es-ES.d.ts +1 -1
- package/dist/api/compiler/locales/es-ES.js +1 -1
- package/dist/api/compiler/locales/fr-FR.d.ts +1 -1
- package/dist/api/compiler/locales/fr-FR.js +1 -1
- package/dist/api/compiler/locales/it-IT.d.ts +1 -1
- package/dist/api/compiler/locales/it-IT.js +1 -1
- package/dist/api/compiler/locales/ja-JP.d.ts +1 -1
- package/dist/api/compiler/locales/ja-JP.js +1 -1
- package/dist/api/compiler/locales/ko-KR.d.ts +1 -1
- package/dist/api/compiler/locales/ko-KR.js +1 -1
- package/dist/api/compiler/locales/pl-PL.d.ts +1 -1
- package/dist/api/compiler/locales/pl-PL.js +1 -1
- package/dist/api/compiler/locales/pt-BR.d.ts +1 -1
- package/dist/api/compiler/locales/pt-BR.js +1 -1
- package/dist/api/compiler/locales/ru-RU.d.ts +1 -1
- package/dist/api/compiler/locales/ru-RU.js +1 -1
- package/dist/api/compiler/locales/tr-TR.d.ts +1 -1
- package/dist/api/compiler/locales/tr-TR.js +1 -1
- package/dist/api/compiler/locales/zh-CN.d.ts +1 -1
- package/dist/api/compiler/locales/zh-CN.js +1 -1
- package/dist/api/compiler/locales/zh-TW.d.ts +1 -1
- package/dist/api/compiler/locales/zh-TW.js +1 -1
- package/dist/api/compiler/module-resolution-types.js +6 -6
- package/dist/api/compiler/module-resolution.d.ts +10 -1
- package/dist/api/compiler/module-resolution.js +115 -84
- package/dist/api/compiler/module-specifiers.d.ts +15 -0
- package/dist/api/compiler/module-specifiers.js +24 -18
- package/dist/api/compiler/name-resolver.js +74 -65
- package/dist/api/compiler/node-builder-names.d.ts +11 -3
- package/dist/api/compiler/node-builder-names.js +210 -90
- package/dist/api/compiler/node-builder-pseudo.js +29 -31
- package/dist/api/compiler/node-builder-reuse.js +23 -22
- package/dist/api/compiler/node-builder.d.ts +18 -1
- package/dist/api/compiler/node-builder.js +191 -102
- package/dist/api/compiler/option-declarations.d.ts +2 -6
- package/dist/api/compiler/option-declarations.js +315 -375
- package/dist/api/compiler/options.d.ts +15 -33
- package/dist/api/compiler/options.js +21 -54
- package/dist/api/compiler/output-paths.d.ts +4 -1
- package/dist/api/compiler/output-paths.js +6 -11
- package/dist/api/compiler/package-json.d.ts +3 -3
- package/dist/api/compiler/package-json.js +11 -10
- package/dist/api/compiler/parallel-parse.d.ts +3 -2
- package/dist/api/compiler/parallel-parse.js +17 -5
- package/dist/api/compiler/parser.d.ts +40 -19
- package/dist/api/compiler/parser.js +308 -216
- package/dist/api/compiler/path.d.ts +9 -0
- package/dist/api/compiler/path.js +20 -3
- package/dist/api/compiler/printer/emit-context.d.ts +5 -1
- package/dist/api/compiler/printer/emit-context.js +20 -1
- package/dist/api/compiler/printer/factory-base.d.ts +2 -2
- package/dist/api/compiler/printer/factory-base.js +7 -3
- package/dist/api/compiler/printer/factory.js +3 -1
- package/dist/api/compiler/printer/helpers.js +10 -1
- package/dist/api/compiler/printer/name-generator.d.ts +1 -1
- package/dist/api/compiler/printer/name-generator.js +35 -16
- package/dist/api/compiler/printer/printer.d.ts +49 -2
- package/dist/api/compiler/printer/printer.js +539 -293
- package/dist/api/compiler/printer/utilities.js +149 -147
- package/dist/api/compiler/program-checker.d.ts +12 -2
- package/dist/api/compiler/program-checker.js +88 -34
- package/dist/api/compiler/program-utilities.d.ts +3 -1
- package/dist/api/compiler/program-utilities.js +28 -15
- package/dist/api/compiler/program.d.ts +4 -6
- package/dist/api/compiler/program.js +74 -87
- package/dist/api/compiler/pseudo-bigint.d.ts +2 -0
- package/dist/api/compiler/pseudo-bigint.js +18 -0
- package/dist/api/compiler/regexp-checker.d.ts +1 -1
- package/dist/api/compiler/regexp-checker.js +93 -76
- package/dist/api/compiler/relations.d.ts +27 -4
- package/dist/api/compiler/relations.js +347 -180
- package/dist/api/compiler/reparser.js +60 -56
- package/dist/api/compiler/scanner.d.ts +19 -2
- package/dist/api/compiler/scanner.js +123 -108
- package/dist/api/compiler/shared-results.d.ts +463 -0
- package/dist/api/compiler/shared-results.js +2128 -0
- package/dist/api/compiler/sourcemap.js +2 -2
- package/dist/api/compiler/symbol-accessibility.js +87 -74
- package/dist/api/compiler/symbol.d.ts +23 -14
- package/dist/api/compiler/symbol.js +23 -11
- package/dist/api/compiler/syntax-kind.d.ts +198 -197
- package/dist/api/compiler/transformers/alias-references.js +247 -139
- package/dist/api/compiler/transformers/async-utilities.js +25 -25
- package/dist/api/compiler/transformers/async.d.ts +0 -1
- package/dist/api/compiler/transformers/async.js +64 -77
- package/dist/api/compiler/transformers/class-fields.d.ts +1 -0
- package/dist/api/compiler/transformers/class-fields.js +81 -78
- package/dist/api/compiler/transformers/commonjs-module.js +18 -15
- package/dist/api/compiler/transformers/const-enum-inliner.js +1 -1
- package/dist/api/compiler/transformers/declarations-diagnostics.js +247 -244
- package/dist/api/compiler/transformers/declarations-pseudo.js +100 -100
- package/dist/api/compiler/transformers/declarations-resolver.d.ts +0 -3
- package/dist/api/compiler/transformers/declarations-syntactic.d.ts +1 -2
- package/dist/api/compiler/transformers/declarations-syntactic.js +134 -156
- package/dist/api/compiler/transformers/declarations-tracker.js +18 -18
- package/dist/api/compiler/transformers/declarations.d.ts +4 -1
- package/dist/api/compiler/transformers/declarations.js +305 -238
- package/dist/api/compiler/transformers/decorator-metadata.d.ts +1 -1
- package/dist/api/compiler/transformers/decorator-metadata.js +53 -45
- package/dist/api/compiler/transformers/decorator-utilities.js +24 -24
- package/dist/api/compiler/transformers/destructuring.js +19 -18
- package/dist/api/compiler/transformers/emit-resolver.js +1 -1
- package/dist/api/compiler/transformers/es-decorators.js +55 -55
- package/dist/api/compiler/transformers/external-module-info.js +3 -3
- package/dist/api/compiler/transformers/for-await.js +25 -25
- package/dist/api/compiler/transformers/import-elision.js +14 -14
- package/dist/api/compiler/transformers/jsx.js +12 -12
- package/dist/api/compiler/transformers/legacy-decorators.js +17 -17
- package/dist/api/compiler/transformers/module.js +8 -8
- package/dist/api/compiler/transformers/named-evaluation.js +4 -4
- package/dist/api/compiler/transformers/object-rest-spread.js +20 -20
- package/dist/api/compiler/transformers/optional-chain.js +10 -10
- package/dist/api/compiler/transformers/reference-resolver.d.ts +12 -1
- package/dist/api/compiler/transformers/reference-resolver.js +131 -69
- package/dist/api/compiler/transformers/runtime-syntax.js +35 -31
- package/dist/api/compiler/transformers/subtree-facts.js +47 -47
- package/dist/api/compiler/transformers/syntax-facts.js +56 -58
- package/dist/api/compiler/transformers/type-eraser.js +73 -66
- package/dist/api/compiler/transformers/type-serialization.js +24 -24
- package/dist/api/compiler/transformers/using.js +12 -12
- package/dist/api/compiler/transformers/utilities.js +77 -77
- package/dist/api/compiler/transformers/visitor-base.js +172 -172
- package/dist/api/compiler/transformers/visitor-hooks.js +6 -2
- package/dist/api/compiler/tsconfig.d.ts +10 -2
- package/dist/api/compiler/tsconfig.js +136 -48
- package/dist/api/compiler/type-printer.js +40 -3
- package/dist/api/compiler/types.d.ts +2 -1
- package/dist/api/library/ast.generated.d.ts +42 -39
- package/dist/api/library/ast.generated.js +1 -1
- package/dist/api/library/compiler-options.generated.d.ts +111 -100
- package/dist/api/library/compiler-options.generated.js +1 -1
- package/dist/api/library/disk.js +12 -1
- package/dist/api/library/enums.generated.d.ts +206 -206
- package/dist/api/library/enums.generated.js +206 -206
- package/dist/api/library/nodes.js +26 -26
- package/package.json +9 -9
- package/src/compiler/ast-utilities.ts +99 -7
- package/src/compiler/ast.ts +58 -26
- package/src/compiler/binder.ts +39 -4
- package/src/compiler/character-codes.ts +2 -2
- package/src/compiler/checker-calls.ts +79 -9
- package/src/compiler/checker-classes.ts +78 -24
- package/src/compiler/checker-contextual.ts +6 -1
- package/src/compiler/checker-declarations.ts +31 -4
- package/src/compiler/checker-declared-types.ts +8 -5
- package/src/compiler/checker-decorators.ts +1 -1
- package/src/compiler/checker-deprecation.ts +29 -8
- package/src/compiler/checker-destructuring.ts +10 -3
- package/src/compiler/checker-emit-helpers.ts +1 -0
- package/src/compiler/checker-emit-resolver.ts +16 -6
- package/src/compiler/checker-expressions.ts +79 -46
- package/src/compiler/checker-functions.ts +21 -6
- package/src/compiler/checker-generated-code.ts +2 -22
- package/src/compiler/checker-grammar.ts +136 -62
- package/src/compiler/checker-heritage.ts +22 -21
- package/src/compiler/checker-inference.ts +514 -82
- package/src/compiler/checker-iteration.ts +18 -31
- package/src/compiler/checker-javascript.ts +1 -1
- package/src/compiler/checker-jsdoc.ts +50 -27
- package/src/compiler/checker-jsx.ts +26 -4
- package/src/compiler/checker-members.ts +200 -56
- package/src/compiler/checker-modules.ts +332 -65
- package/src/compiler/checker-narrowing.ts +98 -19
- package/src/compiler/checker-object-literals.ts +3 -0
- package/src/compiler/checker-operators.ts +11 -4
- package/src/compiler/checker-property-access.ts +7 -2
- package/src/compiler/checker-services.ts +39 -12
- package/src/compiler/checker-signatures.ts +15 -1
- package/src/compiler/checker-source-file.ts +39 -13
- package/src/compiler/checker-statements.ts +3 -2
- package/src/compiler/checker-symbol-types.ts +29 -6
- package/src/compiler/checker-symbols.ts +158 -15
- package/src/compiler/checker-type-factory.ts +124 -23
- package/src/compiler/checker-type-nodes.ts +46 -3
- package/src/compiler/checker-type-operators.ts +83 -26
- package/src/compiler/checker-types.ts +147 -4
- package/src/compiler/checker-unused.ts +9 -14
- package/src/compiler/checker.ts +203 -39
- package/src/compiler/command-line.ts +28 -28
- package/src/compiler/compile-program.ts +167 -27
- package/src/compiler/decoder.ts +13 -4
- package/src/compiler/diagnostic-messages.ts +1973 -1892
- package/src/compiler/diagnostics.ts +84 -3
- package/src/compiler/emitter.ts +57 -8
- package/src/compiler/encoder.ts +23 -8
- package/src/compiler/file-include.ts +9 -3
- package/src/compiler/file-loader.ts +197 -38
- package/src/compiler/help.ts +10 -14
- package/src/compiler/incremental.ts +165 -30
- package/src/compiler/init.ts +2 -7
- package/src/compiler/instantiation.ts +77 -22
- package/src/compiler/jsdoc.ts +3 -1
- package/src/compiler/link-tables.ts +82 -37
- package/src/compiler/locales/cs-CZ.ts +1 -1
- package/src/compiler/locales/de-DE.ts +1 -1
- package/src/compiler/locales/es-ES.ts +1 -1
- package/src/compiler/locales/fr-FR.ts +1 -1
- package/src/compiler/locales/it-IT.ts +1 -1
- package/src/compiler/locales/ja-JP.ts +1 -1
- package/src/compiler/locales/ko-KR.ts +1 -1
- package/src/compiler/locales/pl-PL.ts +1 -1
- package/src/compiler/locales/pt-BR.ts +1 -1
- package/src/compiler/locales/ru-RU.ts +1 -1
- package/src/compiler/locales/tr-TR.ts +1 -1
- package/src/compiler/locales/zh-CN.ts +1 -1
- package/src/compiler/locales/zh-TW.ts +1 -1
- package/src/compiler/module-resolution.ts +44 -8
- package/src/compiler/module-specifiers.ts +62 -20
- package/src/compiler/name-resolver.ts +9 -1
- package/src/compiler/node-builder-names.ts +236 -54
- package/src/compiler/node-builder-pseudo.ts +4 -7
- package/src/compiler/node-builder-reuse.ts +5 -4
- package/src/compiler/node-builder.ts +130 -31
- package/src/compiler/option-declarations.ts +33 -103
- package/src/compiler/options.ts +23 -62
- package/src/compiler/output-paths.ts +5 -18
- package/src/compiler/package-entrypoints.ts +345 -0
- package/src/compiler/package-json.ts +4 -4
- package/src/compiler/parallel-check.ts +326 -52
- package/src/compiler/parallel-emit.ts +320 -0
- package/src/compiler/parallel-parse.ts +16 -5
- package/src/compiler/parse-thread.ts +3 -0
- package/src/compiler/parser.ts +156 -39
- package/src/compiler/path.ts +22 -2
- package/src/compiler/printer/emit-context.ts +21 -0
- package/src/compiler/printer/factory-base.ts +10 -3
- package/src/compiler/printer/factory.ts +4 -1
- package/src/compiler/printer/helpers.ts +10 -1
- package/src/compiler/printer/name-generator.ts +24 -2
- package/src/compiler/printer/printer.ts +266 -30
- package/src/compiler/printer/utilities.ts +8 -2
- package/src/compiler/program-checker.ts +57 -5
- package/src/compiler/program-utilities.ts +23 -10
- package/src/compiler/program.ts +18 -26
- package/src/compiler/pseudo-bigint.ts +17 -0
- package/src/compiler/regexp-checker.ts +63 -30
- package/src/compiler/relations.ts +240 -77
- package/src/compiler/reparser.ts +7 -2
- package/src/compiler/scanner.ts +109 -79
- package/src/compiler/shared-results.ts +2414 -0
- package/src/compiler/show-config.ts +18 -1
- package/src/compiler/sourcemap.ts +2 -2
- package/src/compiler/symbol-accessibility.ts +26 -3
- package/src/compiler/symbol.ts +46 -24
- package/src/compiler/syntax-kind.ts +188 -187
- package/src/compiler/thread-entry.ts +64 -4
- package/src/compiler/transformers/alias-references.ts +123 -4
- package/src/compiler/transformers/async.ts +2 -17
- package/src/compiler/transformers/class-fields.ts +13 -12
- package/src/compiler/transformers/commonjs-module.ts +11 -7
- package/src/compiler/transformers/declarations-diagnostics.ts +5 -3
- package/src/compiler/transformers/declarations-pseudo.ts +2 -4
- package/src/compiler/transformers/declarations-resolver.ts +0 -3
- package/src/compiler/transformers/declarations-syntactic.ts +1 -21
- package/src/compiler/transformers/declarations.ts +134 -48
- package/src/compiler/transformers/decorator-metadata.ts +9 -1
- package/src/compiler/transformers/destructuring.ts +4 -3
- package/src/compiler/transformers/external-module-info.ts +1 -1
- package/src/compiler/transformers/jsx.ts +2 -1
- package/src/compiler/transformers/reference-resolver.ts +83 -19
- package/src/compiler/transformers/runtime-syntax.ts +6 -1
- package/src/compiler/transformers/syntax-facts.ts +2 -7
- package/src/compiler/transformers/type-eraser.ts +10 -1
- package/src/compiler/transformers/type-serialization.ts +3 -2
- package/src/compiler/transformers/visitor-base.ts +2 -1
- package/src/compiler/transformers/visitor-hooks.ts +9 -4
- package/src/compiler/tsc-build.ts +66 -9
- package/src/compiler/tsc-cli.ts +7 -0
- package/src/compiler/tsc-compile.ts +284 -4
- package/src/compiler/tsc-watch.ts +74 -45
- package/src/compiler/tsconfig.ts +176 -19
- package/src/compiler/type-printer.ts +36 -2
- package/src/compiler/types.ts +2 -1
- package/src/library/ast.generated.ts +57 -41
- package/src/library/compiler-options.generated.ts +117 -103
- package/src/library/disk.ts +10 -1
- package/src/library/enums.generated.ts +196 -196
|
@@ -17,7 +17,7 @@ import { isTypeAssignableTo } from './relations.js';
|
|
|
17
17
|
import { checkDeclarationInitializer, checkExpression, checkExpressionCached, checkExpressionEx, checkNonNullType, checkTypeAssignableToAndOptionallyElaborate, } from './checker-expressions.js';
|
|
18
18
|
import { checkIteratedTypeOrElementType, createIterableType } from './checker-iteration.js';
|
|
19
19
|
import { ScriptTarget } from './options.js';
|
|
20
|
-
import { checkBinaryExpression, checkReferenceExpression, removeDefinitelyFalsyTypes } from './checker-operators.js';
|
|
20
|
+
import { checkBinaryExpression, checkReferenceExpression, grammarErrorOnNode, removeDefinitelyFalsyTypes, } from './checker-operators.js';
|
|
21
21
|
import { getNonNullableType, getTypeWithFacts, hasTypeFacts } from './checker-flow.js';
|
|
22
22
|
import { sliceTupleType } from './checker-signatures.js';
|
|
23
23
|
import { getPropertyNameFromType, isTypeUsableAsPropertyName, maybeTypeOfKind } from './checker-utilities.js';
|
|
@@ -25,7 +25,7 @@ import { checkPropertyAccessibility } from './checker-property-access.js';
|
|
|
25
25
|
import { copyDeclarations, declarationAt, declarationCount, getSymbolId, } from './symbol.js';
|
|
26
26
|
function isBindingPatternNode(node) {
|
|
27
27
|
return (node !== undefined &&
|
|
28
|
-
(node.kind ===
|
|
28
|
+
(node.kind === 208 /* SyntaxKind.ObjectBindingPattern */ || node.kind === 209 /* SyntaxKind.ArrayBindingPattern */));
|
|
29
29
|
}
|
|
30
30
|
/** The type of a binding element, from the type of the declaration it destructures. */
|
|
31
31
|
export function getTypeForBindingElement(c, declaration) {
|
|
@@ -75,14 +75,14 @@ function getSyntheticElementAccess(c, node) {
|
|
|
75
75
|
function getParentElementAccess(c, node) {
|
|
76
76
|
const ancestor = node.parent.parent;
|
|
77
77
|
switch (ancestor.kind) {
|
|
78
|
-
case
|
|
79
|
-
case
|
|
78
|
+
case 210 /* SyntaxKind.BindingElement */:
|
|
79
|
+
case 304 /* SyntaxKind.PropertyAssignment */:
|
|
80
80
|
return getSyntheticElementAccess(c, ancestor);
|
|
81
|
-
case
|
|
81
|
+
case 211 /* SyntaxKind.ArrayLiteralExpression */:
|
|
82
82
|
return getSyntheticElementAccess(c, node.parent);
|
|
83
|
-
case
|
|
83
|
+
case 262 /* SyntaxKind.VariableDeclaration */:
|
|
84
84
|
return getInitializer(ancestor);
|
|
85
|
-
case
|
|
85
|
+
case 228 /* SyntaxKind.BinaryExpression */:
|
|
86
86
|
return ancestor.right;
|
|
87
87
|
}
|
|
88
88
|
return undefined;
|
|
@@ -115,11 +115,11 @@ export function getBindingElementTypeFromParentType(c, declaration, parentTypeIn
|
|
|
115
115
|
const accessFlags = 32 /* AccessFlags.ExpressionPosition */ |
|
|
116
116
|
(noTupleBoundsCheck || declaration.initializer !== undefined ? 16 /* AccessFlags.AllowMissing */ : 0);
|
|
117
117
|
let t;
|
|
118
|
-
if (pattern.kind ===
|
|
118
|
+
if (pattern.kind === 208 /* SyntaxKind.ObjectBindingPattern */) {
|
|
119
119
|
if (declaration.dotDotDotToken !== undefined) {
|
|
120
120
|
parentType = getReducedType(c, parentType);
|
|
121
121
|
if ((parentType.flags & 2 /* TypeFlags.Unknown */) !== 0 || !isValidSpreadType(c, parentType)) {
|
|
122
|
-
c.error(declaration,
|
|
122
|
+
c.error(declaration, 839 /* Diagnostics.Rest_types_may_only_be_created_from_object_types */);
|
|
123
123
|
return c.errorType;
|
|
124
124
|
}
|
|
125
125
|
const literalMembers = [];
|
|
@@ -167,7 +167,7 @@ export function getBindingElementTypeFromParentType(c, declaration, parentTypeIn
|
|
|
167
167
|
/** The binding pattern's root declaration: the variable or parameter it destructures. */
|
|
168
168
|
function walkUpBindingElementsAndPatterns(node) {
|
|
169
169
|
let current = node.parent;
|
|
170
|
-
while (current.kind ===
|
|
170
|
+
while (current.kind === 210 /* SyntaxKind.BindingElement */ || isBindingPatternNode(current))
|
|
171
171
|
current = current.parent;
|
|
172
172
|
return current;
|
|
173
173
|
}
|
|
@@ -189,7 +189,7 @@ export function getTypeFromBindingPattern(c, pattern, includePatternInType, repo
|
|
|
189
189
|
// References to the pattern's own elements in its initializers are `any` while its type is a contextual type.
|
|
190
190
|
if (includePatternInType)
|
|
191
191
|
c.contextualBindingPatterns.push(pattern);
|
|
192
|
-
const result = pattern.kind ===
|
|
192
|
+
const result = pattern.kind === 208 /* SyntaxKind.ObjectBindingPattern */
|
|
193
193
|
? getTypeFromObjectBindingPattern(c, pattern, includePatternInType, reportErrors)
|
|
194
194
|
: getTypeFromArrayBindingPattern(c, pattern, includePatternInType, reportErrors);
|
|
195
195
|
if (includePatternInType)
|
|
@@ -228,7 +228,7 @@ function getTypeFromArrayBindingPattern(c, pattern, includePatternInType, report
|
|
|
228
228
|
const elements = getElements(pattern).nodes;
|
|
229
229
|
const last = elements.length > 0 ? elements[elements.length - 1] : undefined;
|
|
230
230
|
const restElement = last !== undefined &&
|
|
231
|
-
last.kind ===
|
|
231
|
+
last.kind === 210 /* SyntaxKind.BindingElement */ &&
|
|
232
232
|
last.dotDotDotToken !== undefined
|
|
233
233
|
? last
|
|
234
234
|
: undefined;
|
|
@@ -283,14 +283,14 @@ function getTypeFromBindingElement(c, element, includePatternInType, reportError
|
|
|
283
283
|
* pattern defaults or binds past the end of a tuple.
|
|
284
284
|
*/
|
|
285
285
|
export function padParameterInitializerType(c, declaration, t) {
|
|
286
|
-
if (getRootDeclaration(declaration).kind !==
|
|
286
|
+
if (getRootDeclaration(declaration).kind !== 171 /* SyntaxKind.Parameter */)
|
|
287
287
|
return t;
|
|
288
288
|
const name = getName(declaration);
|
|
289
289
|
if (name === undefined)
|
|
290
290
|
return t;
|
|
291
|
-
if (name.kind ===
|
|
291
|
+
if (name.kind === 208 /* SyntaxKind.ObjectBindingPattern */ && (t.objectFlags & 128 /* ObjectFlags.ObjectLiteral */) !== 0)
|
|
292
292
|
return padObjectLiteralType(c, t, name);
|
|
293
|
-
if (name.kind ===
|
|
293
|
+
if (name.kind === 209 /* SyntaxKind.ArrayBindingPattern */ && isTupleType(t))
|
|
294
294
|
return padTupleType(c, t, name);
|
|
295
295
|
return t;
|
|
296
296
|
}
|
|
@@ -299,7 +299,7 @@ function padObjectLiteralType(c, t, pattern) {
|
|
|
299
299
|
const missingElements = [];
|
|
300
300
|
for (const node of getElements(pattern).nodes) {
|
|
301
301
|
const e = node;
|
|
302
|
-
if (e.
|
|
302
|
+
if (e.dotDotDotToken !== undefined)
|
|
303
303
|
continue;
|
|
304
304
|
const name = getPropertyNameFromBindingElement(c, e);
|
|
305
305
|
if (name !== undefined && getPropertyOfType(c, t, name) === undefined)
|
|
@@ -312,7 +312,7 @@ function padObjectLiteralType(c, t, pattern) {
|
|
|
312
312
|
members.set(prop.name, prop);
|
|
313
313
|
for (const e of missingElements) {
|
|
314
314
|
const symbol = c.newSymbol(4 /* SymbolFlags.Property */ | 16777216 /* SymbolFlags.Optional */, getPropertyNameFromBindingElement(c, e));
|
|
315
|
-
c.symbolTypes.set(getSymbolId(symbol), getTypeFromBindingElement(c, e, false,
|
|
315
|
+
c.symbolTypes.set(getSymbolId(symbol), getTypeFromBindingElement(c, e, false, true));
|
|
316
316
|
members.set(symbol.name, symbol);
|
|
317
317
|
}
|
|
318
318
|
const result = createAnonymousType(c, t.symbol, members, [], [], getIndexInfosOfType(c, t));
|
|
@@ -338,8 +338,8 @@ export function padTupleType(c, t, pattern) {
|
|
|
338
338
|
for (let i = arity; i < patternElements.length; i++) {
|
|
339
339
|
const e = patternElements[i];
|
|
340
340
|
if (i < patternElements.length - 1 ||
|
|
341
|
-
!(e.kind ===
|
|
342
|
-
const omitted = e.kind ===
|
|
341
|
+
!(e.kind === 210 /* SyntaxKind.BindingElement */ && e.dotDotDotToken !== undefined)) {
|
|
342
|
+
const omitted = e.kind === 234 /* SyntaxKind.OmittedExpression */;
|
|
343
343
|
elementTypes.push(!omitted && hasDefaultValue(e) ? getTypeFromBindingElement(c, e, false, false) : c.anyType);
|
|
344
344
|
elementInfos.push(new TupleElementInfo(2 /* ElementFlags.Optional */, undefined));
|
|
345
345
|
if (!omitted && !hasDefaultValue(e))
|
|
@@ -353,7 +353,7 @@ export function padTupleType(c, t, pattern) {
|
|
|
353
353
|
export function checkDestructuringAssignment(c, node, sourceTypeIn, checkMode, rightIsThis) {
|
|
354
354
|
let sourceType = sourceTypeIn;
|
|
355
355
|
let target = node;
|
|
356
|
-
if (node.kind ===
|
|
356
|
+
if (node.kind === 305 /* SyntaxKind.ShorthandPropertyAssignment */) {
|
|
357
357
|
const shorthand = node;
|
|
358
358
|
const initializer = shorthand.objectAssignmentInitializer;
|
|
359
359
|
if (initializer !== undefined) {
|
|
@@ -364,16 +364,16 @@ export function checkDestructuringAssignment(c, node, sourceTypeIn, checkMode, r
|
|
|
364
364
|
}
|
|
365
365
|
target = shorthand.name;
|
|
366
366
|
}
|
|
367
|
-
if (target.kind ===
|
|
367
|
+
if (target.kind === 228 /* SyntaxKind.BinaryExpression */ &&
|
|
368
368
|
target.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) {
|
|
369
369
|
checkBinaryExpression(c, target, checkMode);
|
|
370
370
|
target = target.left;
|
|
371
371
|
if (c.strictNullChecks)
|
|
372
372
|
sourceType = getTypeWithFacts(c, sourceType, 524288 /* TypeFacts.NEUndefined */);
|
|
373
373
|
}
|
|
374
|
-
if (target.kind ===
|
|
374
|
+
if (target.kind === 212 /* SyntaxKind.ObjectLiteralExpression */)
|
|
375
375
|
return checkObjectLiteralAssignment(c, target, sourceType, rightIsThis);
|
|
376
|
-
if (target.kind ===
|
|
376
|
+
if (target.kind === 211 /* SyntaxKind.ArrayLiteralExpression */)
|
|
377
377
|
return checkArrayLiteralAssignment(c, target, sourceType, checkMode);
|
|
378
378
|
return checkReferenceAssignment(c, target, sourceType, checkMode);
|
|
379
379
|
}
|
|
@@ -381,7 +381,7 @@ export function checkDestructuringAssignment(c, node, sourceTypeIn, checkMode, r
|
|
|
381
381
|
function checkShorthandDefault(c, node, initializer, checkMode) {
|
|
382
382
|
const leftType = checkExpressionCached(c, node.name);
|
|
383
383
|
const rightType = checkExpressionEx(c, initializer, checkMode);
|
|
384
|
-
if (checkReferenceExpression(c, node.name,
|
|
384
|
+
if (checkReferenceExpression(c, node.name, 545 /* Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access */, 918 /* Diagnostics.The_left_hand_side_of_an_assignment_expression_may_not_be_an_optional_property_access */))
|
|
385
385
|
checkTypeAssignableToAndOptionallyElaborate(c, rightType, leftType, node.name, initializer);
|
|
386
386
|
}
|
|
387
387
|
function checkObjectLiteralAssignment(c, node, sourceType, rightIsThis) {
|
|
@@ -394,8 +394,10 @@ function checkObjectLiteralAssignment(c, node, sourceType, rightIsThis) {
|
|
|
394
394
|
}
|
|
395
395
|
function checkObjectLiteralDestructuringPropertyAssignment(c, properties, objectLiteralType, propertyIndex, rightIsThis) {
|
|
396
396
|
const property = properties[propertyIndex];
|
|
397
|
-
if (property.kind ===
|
|
397
|
+
if (property.kind === 304 /* SyntaxKind.PropertyAssignment */ || property.kind === 305 /* SyntaxKind.ShorthandPropertyAssignment */) {
|
|
398
398
|
const name = getName(property);
|
|
399
|
+
if (name.kind === 80 /* SyntaxKind.PrivateIdentifier */)
|
|
400
|
+
grammarErrorOnNode(c, name, 1899 /* Diagnostics.Private_identifiers_cannot_be_used_in_destructuring_patterns */);
|
|
399
401
|
markDestructuredPropertyAsReferenced(c, objectLiteralType, name, property, rightIsThis);
|
|
400
402
|
const exprType = getLiteralTypeFromPropertyName(c, name) ?? c.errorType;
|
|
401
403
|
if (isTypeUsableAsPropertyName(exprType)) {
|
|
@@ -404,20 +406,20 @@ function checkObjectLiteralDestructuringPropertyAssignment(c, properties, object
|
|
|
404
406
|
checkPropertyAccessibility(c, property, false, true, objectLiteralType, prop);
|
|
405
407
|
}
|
|
406
408
|
const elementType = getIndexedAccessTypeEx(c, objectLiteralType, exprType, 32 /* AccessFlags.ExpressionPosition */ | (hasDefaultValue(property) ? 16 /* AccessFlags.AllowMissing */ : 0), name, undefined);
|
|
407
|
-
const expr = property.kind ===
|
|
409
|
+
const expr = property.kind === 304 /* SyntaxKind.PropertyAssignment */ ? property.initializer : property;
|
|
408
410
|
checkDestructuringAssignment(c, expr, getFlowTypeOfDestructuring(c, property, elementType), 0 /* CheckMode.Normal */, false);
|
|
409
411
|
return;
|
|
410
412
|
}
|
|
411
|
-
if (property.kind ===
|
|
413
|
+
if (property.kind === 306 /* SyntaxKind.SpreadAssignment */) {
|
|
412
414
|
if (propertyIndex < properties.length - 1) {
|
|
413
|
-
c.error(property,
|
|
415
|
+
c.error(property, 635 /* Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern */);
|
|
414
416
|
return;
|
|
415
417
|
}
|
|
416
418
|
if (c.languageVersion < ScriptTarget.ES2018)
|
|
417
419
|
checkExternalEmitHelpers(c, property, 1 /* ExternalEmitHelpers.Rest */);
|
|
418
420
|
const nonRestNames = [];
|
|
419
421
|
for (const other of properties)
|
|
420
|
-
if (other.kind !==
|
|
422
|
+
if (other.kind !== 306 /* SyntaxKind.SpreadAssignment */)
|
|
421
423
|
nonRestNames.push(getName(other));
|
|
422
424
|
const t = getRestType(c, objectLiteralType, nonRestNames, objectLiteralType.symbol);
|
|
423
425
|
checkGrammarRestTrailingComma(c, property.parent, getProperties(property.parent));
|
|
@@ -433,7 +435,7 @@ function checkArrayLiteralAssignment(c, node, sourceType, checkMode) {
|
|
|
433
435
|
let inBoundsType = c.noUncheckedIndexedAccess ? undefined : possiblyOutOfBoundsType;
|
|
434
436
|
for (let i = 0; i < elements.length; i++) {
|
|
435
437
|
let t = possiblyOutOfBoundsType;
|
|
436
|
-
if (elements[i].kind ===
|
|
438
|
+
if (elements[i].kind === 232 /* SyntaxKind.SpreadElement */) {
|
|
437
439
|
if (inBoundsType === undefined)
|
|
438
440
|
inBoundsType = checkIteratedTypeOrElementType(c, 65 /* IterationUse.Destructuring */, sourceType, c.undefinedType, node);
|
|
439
441
|
t = inBoundsType;
|
|
@@ -444,14 +446,14 @@ function checkArrayLiteralAssignment(c, node, sourceType, checkMode) {
|
|
|
444
446
|
}
|
|
445
447
|
function checkArrayLiteralDestructuringElementAssignment(c, elements, sourceType, elementIndex, elementType, checkMode) {
|
|
446
448
|
const element = elements[elementIndex];
|
|
447
|
-
if (element.kind ===
|
|
449
|
+
if (element.kind === 234 /* SyntaxKind.OmittedExpression */)
|
|
448
450
|
return;
|
|
449
|
-
if (element.kind !==
|
|
451
|
+
if (element.kind !== 232 /* SyntaxKind.SpreadElement */) {
|
|
450
452
|
if (isArrayLikeType(c, sourceType)) {
|
|
451
453
|
const indexType = getNumberLiteralType(c, elementIndex);
|
|
452
454
|
const accessFlags = 32 /* AccessFlags.ExpressionPosition */ | (hasDefaultValue(element) ? 16 /* AccessFlags.AllowMissing */ : 0);
|
|
453
455
|
// Element access targets would be mistaken for the access itself.
|
|
454
|
-
const accessNode = element.kind ===
|
|
456
|
+
const accessNode = element.kind === 214 /* SyntaxKind.ElementAccessExpression */ ? undefined : element;
|
|
455
457
|
const t = getIndexedAccessTypeOrUndefinedEx(c, sourceType, indexType, accessFlags, accessNode, undefined) ?? c.errorType;
|
|
456
458
|
const assigned = hasDefaultValue(element) ? getTypeWithFacts(c, t, 524288 /* TypeFacts.NEUndefined */) : t;
|
|
457
459
|
checkDestructuringAssignment(c, element, getFlowTypeOfDestructuring(c, element, assigned), checkMode, false);
|
|
@@ -461,11 +463,11 @@ function checkArrayLiteralDestructuringElementAssignment(c, elements, sourceType
|
|
|
461
463
|
return;
|
|
462
464
|
}
|
|
463
465
|
if (elementIndex < elements.length - 1) {
|
|
464
|
-
c.error(element,
|
|
466
|
+
c.error(element, 635 /* Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern */);
|
|
465
467
|
return;
|
|
466
468
|
}
|
|
467
469
|
const restExpression = element.expression;
|
|
468
|
-
if (restExpression.kind ===
|
|
470
|
+
if (restExpression.kind === 228 /* SyntaxKind.BinaryExpression */ &&
|
|
469
471
|
restExpression.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) {
|
|
470
472
|
c.error(restExpression.operatorToken, 142 /* Diagnostics.A_rest_element_cannot_have_an_initializer */);
|
|
471
473
|
return;
|
|
@@ -478,25 +480,25 @@ function checkArrayLiteralDestructuringElementAssignment(c, elements, sourceType
|
|
|
478
480
|
}
|
|
479
481
|
function checkReferenceAssignment(c, target, sourceType, checkMode) {
|
|
480
482
|
const targetType = checkExpressionEx(c, target, checkMode);
|
|
481
|
-
const inRest = target.parent.kind ===
|
|
483
|
+
const inRest = target.parent.kind === 306 /* SyntaxKind.SpreadAssignment */;
|
|
482
484
|
if (checkReferenceExpression(c, target, inRest
|
|
483
|
-
?
|
|
484
|
-
:
|
|
485
|
-
?
|
|
486
|
-
:
|
|
485
|
+
? 840 /* Diagnostics.The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access */
|
|
486
|
+
: 545 /* Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access */, inRest
|
|
487
|
+
? 917 /* Diagnostics.The_target_of_an_object_rest_assignment_may_not_be_an_optional_property_access */
|
|
488
|
+
: 918 /* Diagnostics.The_left_hand_side_of_an_assignment_expression_may_not_be_an_optional_property_access */))
|
|
487
489
|
checkTypeAssignableToAndOptionallyElaborate(c, sourceType, targetType, target, target);
|
|
488
490
|
return sourceType;
|
|
489
491
|
}
|
|
490
492
|
/** Whether a destructuring element has a default value. */
|
|
491
493
|
export function hasDefaultValue(node) {
|
|
492
494
|
switch (node.kind) {
|
|
493
|
-
case
|
|
495
|
+
case 210 /* SyntaxKind.BindingElement */:
|
|
494
496
|
return node.initializer !== undefined;
|
|
495
|
-
case
|
|
497
|
+
case 304 /* SyntaxKind.PropertyAssignment */:
|
|
496
498
|
return hasDefaultValue(node.initializer);
|
|
497
|
-
case
|
|
499
|
+
case 305 /* SyntaxKind.ShorthandPropertyAssignment */:
|
|
498
500
|
return node.objectAssignmentInitializer !== undefined;
|
|
499
|
-
case
|
|
501
|
+
case 228 /* SyntaxKind.BinaryExpression */:
|
|
500
502
|
return node.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */;
|
|
501
503
|
}
|
|
502
504
|
return false;
|
|
@@ -562,7 +564,7 @@ export function getSpreadSymbol(c, prop, readonly) {
|
|
|
562
564
|
const isSetonlyAccessor = (prop.flags & 65536 /* SymbolFlags.SetAccessor */) !== 0 && (prop.flags & 32768 /* SymbolFlags.GetAccessor */) === 0;
|
|
563
565
|
if (!isSetonlyAccessor && readonly === isReadonlySymbol(c, prop))
|
|
564
566
|
return prop;
|
|
565
|
-
const result = c.newSymbolWithCheckFlags(4 /* SymbolFlags.Property */ | (prop.flags & 16777216 /* SymbolFlags.Optional */), prop.name, (prop.checkFlags &
|
|
567
|
+
const result = c.newSymbolWithCheckFlags(4 /* SymbolFlags.Property */ | (prop.flags & 16777216 /* SymbolFlags.Optional */), prop.name, (prop.checkFlags & 32768 /* CheckFlags.Late */) | (readonly ? 8 /* CheckFlags.Readonly */ : 0));
|
|
566
568
|
const id = getSymbolId(result);
|
|
567
569
|
c.symbolTypes.set(id, isSetonlyAccessor ? c.undefinedType : getTypeOfSymbol(c, prop));
|
|
568
570
|
copyDeclarations(result, prop);
|
|
@@ -40,27 +40,27 @@ export function elaborateError(c, node, source, target, relation, headMessage, d
|
|
|
40
40
|
elaborateDidYouMeanToCallOrConstruct(c, node, source, target, relation, 0 /* SignatureKind.Call */, headMessage, diagnosticOutput))
|
|
41
41
|
return true;
|
|
42
42
|
switch (node.kind) {
|
|
43
|
-
case
|
|
43
|
+
case 236 /* SyntaxKind.AsExpression */:
|
|
44
44
|
if (!isConstAssertion(node))
|
|
45
45
|
break;
|
|
46
46
|
return elaborateError(c, getExpression(node), source, target, relation, headMessage, diagnosticOutput);
|
|
47
|
-
case
|
|
48
|
-
case
|
|
47
|
+
case 296 /* SyntaxKind.JsxExpression */:
|
|
48
|
+
case 219 /* SyntaxKind.ParenthesizedExpression */:
|
|
49
49
|
return elaborateError(c, getExpression(node), source, target, relation, headMessage, diagnosticOutput);
|
|
50
|
-
case
|
|
50
|
+
case 228 /* SyntaxKind.BinaryExpression */: {
|
|
51
51
|
const binary = node;
|
|
52
52
|
const op = binary.operatorToken.kind;
|
|
53
53
|
if (op === 63 /* SyntaxKind.EqualsToken */ || op === 27 /* SyntaxKind.CommaToken */)
|
|
54
54
|
return elaborateError(c, binary.right, source, target, relation, headMessage, diagnosticOutput);
|
|
55
55
|
break;
|
|
56
56
|
}
|
|
57
|
-
case
|
|
57
|
+
case 212 /* SyntaxKind.ObjectLiteralExpression */:
|
|
58
58
|
return elaborateObjectLiteral(c, node, source, target, relation, diagnosticOutput);
|
|
59
|
-
case
|
|
59
|
+
case 211 /* SyntaxKind.ArrayLiteralExpression */:
|
|
60
60
|
return elaborateArrayLiteral(c, node, source, target, relation, diagnosticOutput);
|
|
61
|
-
case
|
|
61
|
+
case 221 /* SyntaxKind.ArrowFunction */:
|
|
62
62
|
return elaborateArrowFunction(c, node, source, target, relation, diagnosticOutput);
|
|
63
|
-
case
|
|
63
|
+
case 294 /* SyntaxKind.JsxAttributes */:
|
|
64
64
|
return elaborateJsxComponents(c, node, source, target, relation, diagnosticOutput);
|
|
65
65
|
}
|
|
66
66
|
return false;
|
|
@@ -95,8 +95,8 @@ function elaborateDidYouMeanToCallOrConstruct(c, node, source, target, relation,
|
|
|
95
95
|
return false;
|
|
96
96
|
const diagnostic = diagnostics[0];
|
|
97
97
|
diagnostic.addRelatedInfo(createDiagnosticForNode(node, kind === 1 /* SignatureKind.Construct */
|
|
98
|
-
?
|
|
99
|
-
:
|
|
98
|
+
? 1377 /* Diagnostics.Did_you_mean_to_use_new_with_this_expression */
|
|
99
|
+
: 1376 /* Diagnostics.Did_you_mean_to_call_this_expression */, []));
|
|
100
100
|
reportDiagnostic(c, diagnostic, diagnosticOutput);
|
|
101
101
|
return true;
|
|
102
102
|
}
|
|
@@ -105,7 +105,7 @@ function elaborateObjectLiteral(c, node, source, target, relation, diagnosticOut
|
|
|
105
105
|
return false;
|
|
106
106
|
let reportedError = false;
|
|
107
107
|
for (const prop of getProperties(node).nodes) {
|
|
108
|
-
if (prop.kind ===
|
|
108
|
+
if (prop.kind === 306 /* SyntaxKind.SpreadAssignment */)
|
|
109
109
|
continue;
|
|
110
110
|
const symbol = getSymbolOfDeclaration(c, prop);
|
|
111
111
|
if (symbol === undefined)
|
|
@@ -114,17 +114,17 @@ function elaborateObjectLiteral(c, node, source, target, relation, diagnosticOut
|
|
|
114
114
|
if ((nameType.flags & 262144 /* TypeFlags.Never */) !== 0)
|
|
115
115
|
continue;
|
|
116
116
|
switch (prop.kind) {
|
|
117
|
-
case
|
|
118
|
-
case
|
|
119
|
-
case
|
|
120
|
-
case
|
|
117
|
+
case 180 /* SyntaxKind.SetAccessor */:
|
|
118
|
+
case 179 /* SyntaxKind.GetAccessor */:
|
|
119
|
+
case 176 /* SyntaxKind.MethodDeclaration */:
|
|
120
|
+
case 305 /* SyntaxKind.ShorthandPropertyAssignment */:
|
|
121
121
|
reportedError =
|
|
122
122
|
elaborateElement(c, source, target, relation, getName(prop), undefined, nameType, undefined, undefined, [], diagnosticOutput) || reportedError;
|
|
123
123
|
break;
|
|
124
|
-
case
|
|
124
|
+
case 304 /* SyntaxKind.PropertyAssignment */: {
|
|
125
125
|
const name = getName(prop);
|
|
126
126
|
const message = isComputedNonLiteralName(name)
|
|
127
|
-
?
|
|
127
|
+
? 596 /* Diagnostics.Type_of_computed_property_s_value_is_0_which_is_not_assignable_to_type_1 */
|
|
128
128
|
: undefined;
|
|
129
129
|
reportedError =
|
|
130
130
|
elaborateElement(c, source, target, relation, name, prop.initializer, nameType, message, undefined, [], diagnosticOutput) || reportedError;
|
|
@@ -135,7 +135,7 @@ function elaborateObjectLiteral(c, node, source, target, relation, diagnosticOut
|
|
|
135
135
|
return reportedError;
|
|
136
136
|
}
|
|
137
137
|
function isComputedNonLiteralName(name) {
|
|
138
|
-
if (name.kind !==
|
|
138
|
+
if (name.kind !== 169 /* SyntaxKind.ComputedPropertyName */)
|
|
139
139
|
return false;
|
|
140
140
|
const expression = getExpression(name);
|
|
141
141
|
return expression.kind !== 10 /* SyntaxKind.StringLiteral */ && expression.kind !== 8 /* SyntaxKind.NumericLiteral */;
|
|
@@ -157,7 +157,7 @@ function elaborateArrayLiteral(c, node, source, target, relation, diagnosticOutp
|
|
|
157
157
|
const elements = getElements(node).nodes;
|
|
158
158
|
for (let i = 0; i < elements.length; i++) {
|
|
159
159
|
const element = elements[i];
|
|
160
|
-
if (element.kind ===
|
|
160
|
+
if (element.kind === 234 /* SyntaxKind.OmittedExpression */ ||
|
|
161
161
|
(isTupleLikeType(c, target) && getPropertyOfType(c, target, String(i)) === undefined))
|
|
162
162
|
continue;
|
|
163
163
|
const checkNode = getEffectiveCheckNode(element);
|
|
@@ -188,7 +188,7 @@ export function elaborateElement(c, source, target, relation, prop, next, nameTy
|
|
|
188
188
|
if (customMessage !== undefined)
|
|
189
189
|
diagnostics.push(createDiagnosticForNode(prop, customMessage, customArgs));
|
|
190
190
|
else if (c.exactOptionalPropertyTypes && isExactOptionalPropertyMismatch(c, specificSource, targetPropType))
|
|
191
|
-
diagnostics.push(createDiagnosticForNode(prop,
|
|
191
|
+
diagnostics.push(createDiagnosticForNode(prop, 590 /* Diagnostics.Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefined_to_the_type_of_the_target */, [typeToString(c, specificSource), typeToString(c, targetPropType)]));
|
|
192
192
|
else {
|
|
193
193
|
const propName = getPropertyNameFromIndex(nameType);
|
|
194
194
|
const targetProperty = propName !== undefined ? getPropertyOfType(c, target, propName) : undefined;
|
|
@@ -218,7 +218,7 @@ export function elaborateElement(c, source, target, relation, prop, next, nameTy
|
|
|
218
218
|
indexInfo.declaration !== undefined &&
|
|
219
219
|
!c.host.isSourceFileDefaultLibrary(getSourceFileOfNode(indexInfo.declaration))) {
|
|
220
220
|
issuedElaboration = true;
|
|
221
|
-
diagnostic.addRelatedInfo(createDiagnosticForNode(indexInfo.declaration,
|
|
221
|
+
diagnostic.addRelatedInfo(createDiagnosticForNode(indexInfo.declaration, 1527 /* Diagnostics.The_expected_type_comes_from_this_index_signature */, []));
|
|
222
222
|
}
|
|
223
223
|
}
|
|
224
224
|
if (!issuedElaboration &&
|
|
@@ -230,7 +230,7 @@ export function elaborateElement(c, source, target, relation, prop, next, nameTy
|
|
|
230
230
|
if (propertyName === '' || (nameType.flags & 16384 /* TypeFlags.UniqueESSymbol */) !== 0)
|
|
231
231
|
propertyName = typeToString(c, nameType);
|
|
232
232
|
if (!c.host.isSourceFileDefaultLibrary(getSourceFileOfNode(targetNode)))
|
|
233
|
-
diagnostic.addRelatedInfo(createDiagnosticForNode(targetNode,
|
|
233
|
+
diagnostic.addRelatedInfo(createDiagnosticForNode(targetNode, 1526 /* Diagnostics.The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1 */, [propertyName, typeToString(c, target)]));
|
|
234
234
|
}
|
|
235
235
|
reportDiagnostic(c, diagnostic, diagnosticOutput);
|
|
236
236
|
return true;
|
|
@@ -254,7 +254,7 @@ export function checkExpressionForMutableLocationWithContextualType(c, next, sou
|
|
|
254
254
|
}
|
|
255
255
|
function elaborateArrowFunction(c, node, source, target, relation, diagnosticOutput) {
|
|
256
256
|
// Blocks and functions with annotated parameters aren't elaborated.
|
|
257
|
-
if (node.body.kind ===
|
|
257
|
+
if (node.body.kind === 243 /* SyntaxKind.Block */)
|
|
258
258
|
return false;
|
|
259
259
|
for (const p of getParameters(node).nodes)
|
|
260
260
|
if (getType(p) !== undefined)
|
|
@@ -281,7 +281,7 @@ function elaborateArrowFunction(c, node, source, target, relation, diagnosticOut
|
|
|
281
281
|
return false;
|
|
282
282
|
const diagnostic = diagnostics[0];
|
|
283
283
|
if (target.symbol !== undefined && declarationCount(target.symbol) !== 0)
|
|
284
|
-
diagnostic.addRelatedInfo(createDiagnosticForNode(target.symbol.declaration,
|
|
284
|
+
diagnostic.addRelatedInfo(createDiagnosticForNode(target.symbol.declaration, 1528 /* Diagnostics.The_expected_type_comes_from_the_return_type_of_this_signature */, []));
|
|
285
285
|
if ((getFunctionFlags(node) & 2 /* FunctionFlags.Async */) === 0 &&
|
|
286
286
|
getTypeOfPropertyOfType(c, sourceReturn, 'then') === undefined &&
|
|
287
287
|
checkTypeRelatedTo(c, createPromiseType(c, sourceReturn), targetReturn, relation, undefined, undefined, undefined))
|
|
@@ -62,14 +62,14 @@ export function checkExternalEmitHelpers(c, location, helpers) {
|
|
|
62
62
|
for (const name of getHelperNames(c, helper)) {
|
|
63
63
|
const symbol = resolveSymbol(c, getSymbolOfMeaning(c, getExportsOfModule(c, helpersModule), name, 111551 /* SymbolFlags.Value */));
|
|
64
64
|
if (symbol === undefined)
|
|
65
|
-
c.error(location,
|
|
65
|
+
c.error(location, 526 /* Diagnostics.This_syntax_requires_an_imported_helper_named_1_which_does_not_exist_in_0_Consider_upgrading_your_version_of_0 */, 'tslib', name);
|
|
66
66
|
else if ((helper & 8192 /* ExternalEmitHelpers.ClassPrivateFieldGet */) !== 0) {
|
|
67
67
|
if (!hasSignatureWithArityGreaterThan(c, symbol, 3))
|
|
68
|
-
c.error(location,
|
|
68
|
+
c.error(location, 945 /* Diagnostics.This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_one_in_0_Consider_upgrading_your_version_of_0 */, 'tslib', name, '4');
|
|
69
69
|
}
|
|
70
70
|
else if ((helper & 16384 /* ExternalEmitHelpers.ClassPrivateFieldSet */) !== 0) {
|
|
71
71
|
if (!hasSignatureWithArityGreaterThan(c, symbol, 4))
|
|
72
|
-
c.error(location,
|
|
72
|
+
c.error(location, 945 /* Diagnostics.This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_one_in_0_Consider_upgrading_your_version_of_0 */, 'tslib', name, '5');
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
}
|
|
@@ -105,7 +105,7 @@ function resolveHelpersModule(c, file, errorNode) {
|
|
|
105
105
|
const links = fileLinks(c, file);
|
|
106
106
|
if (links.helpersModule === undefined)
|
|
107
107
|
links.helpersModule =
|
|
108
|
-
resolveExternalModule(c, c.host.getImportHelpersImportSpecifier(file) ?? errorNode, 'tslib',
|
|
108
|
+
resolveExternalModule(c, c.host.getImportHelpersImportSpecifier(file) ?? errorNode, 'tslib', 537 /* Diagnostics.This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found */, errorNode, false, undefined) ?? c.unknownSymbol;
|
|
109
109
|
return links.helpersModule;
|
|
110
110
|
}
|
|
111
111
|
function getHelperNames(c, helper) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type EntityName, type FileReference, type Identifier, type ImportDeclaration, ModifierFlags, type Node, SourceFile } from './ast.js';
|
|
2
2
|
import type { Checker } from './checker.js';
|
|
3
|
-
import type { CompilerOptions
|
|
3
|
+
import type { CompilerOptions } from './options.js';
|
|
4
4
|
import type { EmitContext } from './printer/emit-context.js';
|
|
5
5
|
import { DeclarationEmitResolver, NodeBuilderFlags, type SymbolAccessibilityResult, type SymbolTracker } from './transformers/declarations-resolver.js';
|
|
6
6
|
import type { SyntacticDeclarationEmitResolver } from './transformers/declarations-syntactic.js';
|
|
@@ -13,6 +13,9 @@ export declare class CheckerDeclarationEmitResolver extends DeclarationEmitResol
|
|
|
13
13
|
/** Answers the queries that don't need types. */
|
|
14
14
|
private readonly syntactic;
|
|
15
15
|
private readonly aliasesMarked;
|
|
16
|
+
/** The emit context of the last node builder, and the caches the builders for it share. */
|
|
17
|
+
private builderContext;
|
|
18
|
+
private builderCaches;
|
|
16
19
|
constructor(checker: Checker, syntactic: SyntacticDeclarationEmitResolver);
|
|
17
20
|
markLinkedReferences(file: SourceFile): boolean;
|
|
18
21
|
isReferencedAliasDeclaration(node: Node): boolean;
|
|
@@ -46,7 +49,6 @@ export declare class CheckerDeclarationEmitResolver extends DeclarationEmitResol
|
|
|
46
49
|
isExpandoFunctionDeclaration(node: Node): boolean;
|
|
47
50
|
getExpandoPropertyDeclarations(node: Node): Node[];
|
|
48
51
|
private getPropertiesOfContainerFunction;
|
|
49
|
-
getResolutionModeOverride(node: Node): ModuleKind | undefined;
|
|
50
52
|
getSourceFileFromReference(file: SourceFile, reference: FileReference): SourceFile | undefined;
|
|
51
53
|
getReferencedMemberValueDeclaration(node: Node): Node | undefined;
|
|
52
54
|
isThisPropertyAssignmentDeclarationRedundant(node: Node): boolean;
|
|
@@ -17,7 +17,7 @@ import { getExportsOfModule, getFirstIdentifier, getGlobalSymbol, getGlobalValue
|
|
|
17
17
|
import { isArrayType, isErrorType, isFreshLiteralType, isTupleType } from './checker-type-factory.js';
|
|
18
18
|
import { isTypeAssignableToKind } from './checker-type-operators.js';
|
|
19
19
|
import { hasLateBindableName } from './checker-utilities.js';
|
|
20
|
-
import { NodeBuilder, isEntityNameVisible, isOptionalParameter } from './node-builder.js';
|
|
20
|
+
import { NodeBuilder, NodeBuilderCaches, isEntityNameVisible, isOptionalParameter } from './node-builder.js';
|
|
21
21
|
import { getRegularTypeOfExpression, newPseudoChecker, requiresAddingImplicitUndefinedForDeclaration, } from './node-builder-pseudo.js';
|
|
22
22
|
import { symbolToExpression } from './node-builder-names.js';
|
|
23
23
|
import { tryReuseExistingNode } from './node-builder-reuse.js';
|
|
@@ -25,6 +25,7 @@ import { isTypeIdenticalTo } from './relations.js';
|
|
|
25
25
|
import { beginDeclarationEmitVisibility, isDeclarationVisible, isSymbolAccessible, markDeclarationVisible, } from './symbol-accessibility.js';
|
|
26
26
|
import { DeclarationEmitResolver, } from './transformers/declarations-resolver.js';
|
|
27
27
|
import { SyntacticEmitResolver } from './transformers/emit-resolver.js';
|
|
28
|
+
import { getSignatureOfFullSignatureType } from './checker-jsdoc.js';
|
|
28
29
|
import { declarationCount, getDeclarations } from './symbol.js';
|
|
29
30
|
const declarationEmitInternalFlags = 8 /* NodeBuilderInternalFlags.AllowUnresolvedNames */;
|
|
30
31
|
const aliasMeaning = 111551 /* SymbolFlags.Value */ | 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */ | 2097152 /* SymbolFlags.Alias */;
|
|
@@ -33,11 +34,16 @@ export class CheckerDeclarationEmitResolver extends DeclarationEmitResolver {
|
|
|
33
34
|
/** Answers the queries that don't need types. */
|
|
34
35
|
syntactic;
|
|
35
36
|
aliasesMarked;
|
|
37
|
+
/** The emit context of the last node builder, and the caches the builders for it share. */
|
|
38
|
+
builderContext;
|
|
39
|
+
builderCaches;
|
|
36
40
|
constructor(checker, syntactic) {
|
|
37
41
|
super();
|
|
38
42
|
this.checker = checker;
|
|
39
43
|
this.syntactic = syntactic;
|
|
40
44
|
this.aliasesMarked = new Set();
|
|
45
|
+
this.builderContext = undefined;
|
|
46
|
+
this.builderCaches = undefined;
|
|
41
47
|
}
|
|
42
48
|
// JavaScript emit
|
|
43
49
|
markLinkedReferences(file) {
|
|
@@ -98,9 +104,9 @@ export class CheckerDeclarationEmitResolver extends DeclarationEmitResolver {
|
|
|
98
104
|
let exportSymbol = undefined;
|
|
99
105
|
if (node.kind !== 10 /* SyntaxKind.StringLiteral */ &&
|
|
100
106
|
parent !== undefined &&
|
|
101
|
-
(parent.kind ===
|
|
107
|
+
(parent.kind === 279 /* SyntaxKind.ExportAssignment */ || isCommonJSModuleExports(parent)))
|
|
102
108
|
exportSymbol = resolveName(c, node, getText(node), aliasMeaning, undefined, false, false);
|
|
103
|
-
else if (parent !== undefined && parent.kind ===
|
|
109
|
+
else if (parent !== undefined && parent.kind === 283 /* SyntaxKind.ExportSpecifier */)
|
|
104
110
|
exportSymbol = getTargetOfExportSpecifier(c, parent, aliasMeaning, false);
|
|
105
111
|
const visited = new Set();
|
|
106
112
|
while (exportSymbol !== undefined && !visited.has(exportSymbol)) {
|
|
@@ -109,7 +115,7 @@ export class CheckerDeclarationEmitResolver extends DeclarationEmitResolver {
|
|
|
109
115
|
for (const declaration of getDeclarations(exportSymbol)) {
|
|
110
116
|
markDeclarationVisible(c, declaration);
|
|
111
117
|
if (declaration instanceof ImportEqualsDeclaration &&
|
|
112
|
-
declaration.moduleReference.kind !==
|
|
118
|
+
declaration.moduleReference.kind !== 285 /* SyntaxKind.ExternalModuleReference */) {
|
|
113
119
|
const first = getFirstIdentifier(declaration.moduleReference);
|
|
114
120
|
next = resolveName(c, declaration, getText(first), aliasMeaning, undefined, false, false);
|
|
115
121
|
}
|
|
@@ -159,13 +165,16 @@ export class CheckerDeclarationEmitResolver extends DeclarationEmitResolver {
|
|
|
159
165
|
if ((node.flags & 16 /* NodeFlags.Synthesized */) !== 0 || !nodeIsPresent(getBody(node)))
|
|
160
166
|
return false;
|
|
161
167
|
// Accessors have up to two signatures but never overloads.
|
|
162
|
-
if (node.kind ===
|
|
168
|
+
if (node.kind === 179 /* SyntaxKind.GetAccessor */ || node.kind === 180 /* SyntaxKind.SetAccessor */)
|
|
163
169
|
return false;
|
|
164
170
|
const c = this.checker;
|
|
165
171
|
const signatures = getSignaturesOfSymbol(c, getSymbolOfDeclaration(c, node));
|
|
166
172
|
if (signatures.length > 1)
|
|
167
173
|
return true;
|
|
168
174
|
if (signatures.length === 1) {
|
|
175
|
+
// A JSDoc `@type` signature of the function itself is not an overload.
|
|
176
|
+
if (signatures[0] === getSignatureOfFullSignatureType(c, node))
|
|
177
|
+
return false;
|
|
169
178
|
const declaration = signatures[0].declaration;
|
|
170
179
|
if (declaration !== node && declaration !== undefined && (declaration.flags & 4194304 /* NodeFlags.JSDoc */) === 0)
|
|
171
180
|
return true;
|
|
@@ -176,7 +185,7 @@ export class CheckerDeclarationEmitResolver extends DeclarationEmitResolver {
|
|
|
176
185
|
if ((node.flags & 16 /* NodeFlags.Synthesized */) !== 0)
|
|
177
186
|
return false;
|
|
178
187
|
const symbol = getSymbolOfDeclaration(this.checker, node);
|
|
179
|
-
return symbol !== undefined && (symbol.checkFlags &
|
|
188
|
+
return symbol !== undefined && (symbol.checkFlags & 32768 /* CheckFlags.Late */) !== 0;
|
|
180
189
|
}
|
|
181
190
|
isDefinitelyReferenceToGlobalSymbolObject(node) {
|
|
182
191
|
if (!(node instanceof PropertyAccessExpression) || node.name.kind !== 79 /* SyntaxKind.Identifier */)
|
|
@@ -219,14 +228,14 @@ export class CheckerDeclarationEmitResolver extends DeclarationEmitResolver {
|
|
|
219
228
|
if ((node.flags & 16 /* NodeFlags.Synthesized */) !== 0)
|
|
220
229
|
return false;
|
|
221
230
|
for (const p of this.getPropertiesOfContainerFunction(node))
|
|
222
|
-
if (p.valueDeclaration !== undefined && p.valueDeclaration.kind ===
|
|
231
|
+
if (p.valueDeclaration !== undefined && p.valueDeclaration.kind === 228 /* SyntaxKind.BinaryExpression */)
|
|
223
232
|
return true;
|
|
224
233
|
return false;
|
|
225
234
|
}
|
|
226
235
|
getExpandoPropertyDeclarations(node) {
|
|
227
236
|
const result = [];
|
|
228
237
|
for (const p of this.getPropertiesOfContainerFunction(node))
|
|
229
|
-
if (p.valueDeclaration !== undefined && p.valueDeclaration.kind ===
|
|
238
|
+
if (p.valueDeclaration !== undefined && p.valueDeclaration.kind === 228 /* SyntaxKind.BinaryExpression */)
|
|
230
239
|
result.push(p.valueDeclaration);
|
|
231
240
|
return result;
|
|
232
241
|
}
|
|
@@ -237,9 +246,6 @@ export class CheckerDeclarationEmitResolver extends DeclarationEmitResolver {
|
|
|
237
246
|
return [];
|
|
238
247
|
return getPropertiesOfType(c, getTypeOfSymbol(c, symbol));
|
|
239
248
|
}
|
|
240
|
-
getResolutionModeOverride(node) {
|
|
241
|
-
return this.syntactic.getResolutionModeOverride(node);
|
|
242
|
-
}
|
|
243
249
|
getSourceFileFromReference(file, reference) {
|
|
244
250
|
return this.syntactic.getSourceFileFromReference(file, reference);
|
|
245
251
|
}
|
|
@@ -281,6 +287,12 @@ export class CheckerDeclarationEmitResolver extends DeclarationEmitResolver {
|
|
|
281
287
|
const b = new NodeBuilder(this.checker, enclosingDeclaration, flags, declarationEmitInternalFlags, tracker, context);
|
|
282
288
|
b.pseudo = newPseudoChecker(this.checker);
|
|
283
289
|
b.declarationOrder = true;
|
|
290
|
+
// tsgo's emit resolver, one per emit context, keeps one node builder for all its requests.
|
|
291
|
+
if (context !== this.builderContext || this.builderCaches === undefined) {
|
|
292
|
+
this.builderContext = context;
|
|
293
|
+
this.builderCaches = new NodeBuilderCaches();
|
|
294
|
+
}
|
|
295
|
+
b.useCaches(this.builderCaches);
|
|
284
296
|
return b;
|
|
285
297
|
}
|
|
286
298
|
createTypeOfDeclaration(context, declaration, enclosingDeclaration, flags, tracker) {
|
|
@@ -429,7 +441,7 @@ export function getTypeReferenceSerializationKind(c, typeName, location) {
|
|
|
429
441
|
return 0 /* TypeReferenceSerializationKind.Unknown */;
|
|
430
442
|
// The value must be reachable at runtime.
|
|
431
443
|
let isTypeOnly = false;
|
|
432
|
-
if (typeName.kind ===
|
|
444
|
+
if (typeName.kind === 168 /* SyntaxKind.QualifiedName */) {
|
|
433
445
|
const root = resolveEntityName(c, getFirstIdentifier(typeName), 111551 /* SymbolFlags.Value */, true, true, location);
|
|
434
446
|
if (root !== undefined && declarationCount(root) > 0)
|
|
435
447
|
isTypeOnly = getDeclarations(root).every(isTypeOnlyImportOrExportDeclaration);
|
|
@@ -535,7 +547,7 @@ function areComponentsSerializable(c, components, enclosingDeclaration) {
|
|
|
535
547
|
for (const component of components) {
|
|
536
548
|
const name = getName(component);
|
|
537
549
|
if (name === undefined ||
|
|
538
|
-
name.kind !==
|
|
550
|
+
name.kind !== 169 /* SyntaxKind.ComputedPropertyName */ ||
|
|
539
551
|
!isEntityNameExpressionNode(getExpression(name)) ||
|
|
540
552
|
isEntityNameVisible(c, getExpression(name), enclosingDeclaration, false).accessibility !==
|
|
541
553
|
0 /* SymbolAccessibility.Accessible */)
|