tsc-ts 0.0.10 → 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 +1 -1
- 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 +20 -15
- package/dist/api/compiler/ast.js +1023 -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 +173 -123
- 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 +469 -438
- 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 -113
- 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 +210 -74
- 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 +137 -34
- 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 +93 -31
- package/dist/api/compiler/checker.js +143 -35
- 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 +19 -4
- package/dist/api/compiler/compile-program.js +45 -26
- package/dist/api/compiler/diagnostic-messages.d.ts +1849 -1774
- package/dist/api/compiler/diagnostic-messages.js +128 -122
- package/dist/api/compiler/diagnostics.js +7 -7
- 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 +10 -0
- package/dist/api/compiler/file-loader.js +138 -41
- 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/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 +3 -1
- package/dist/api/compiler/printer/emit-context.js +16 -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 +1 -0
- package/dist/api/compiler/printer/printer.js +303 -281
- package/dist/api/compiler/printer/utilities.js +149 -147
- package/dist/api/compiler/program-checker.d.ts +8 -2
- package/dist/api/compiler/program-checker.js +84 -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 +2 -0
- package/dist/api/compiler/program.js +69 -57
- 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 +337 -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 +22 -13
- package/dist/api/compiler/symbol.js +15 -1
- 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 +55 -26
- package/src/compiler/binder.ts +39 -4
- package/src/compiler/character-codes.ts +2 -2
- package/src/compiler/checker-calls.ts +76 -8
- 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 +133 -60
- package/src/compiler/checker-heritage.ts +22 -21
- package/src/compiler/checker-inference.ts +514 -87
- 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 +197 -55
- 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 +120 -21
- 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 +168 -41
- package/src/compiler/command-line.ts +28 -28
- package/src/compiler/compile-program.ts +51 -25
- package/src/compiler/decoder.ts +13 -4
- package/src/compiler/diagnostic-messages.ts +1973 -1892
- 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 +139 -32
- package/src/compiler/help.ts +10 -14
- package/src/compiler/incremental.ts +86 -18
- 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 +197 -8
- package/src/compiler/parallel-emit.ts +1 -1
- package/src/compiler/parser.ts +156 -39
- package/src/compiler/path.ts +22 -2
- package/src/compiler/printer/emit-context.ts +16 -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 +35 -14
- package/src/compiler/printer/utilities.ts +8 -2
- package/src/compiler/program-checker.ts +53 -5
- package/src/compiler/program-utilities.ts +23 -10
- package/src/compiler/program.ts +13 -1
- package/src/compiler/pseudo-bigint.ts +17 -0
- package/src/compiler/regexp-checker.ts +63 -30
- package/src/compiler/relations.ts +233 -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 +31 -14
- package/src/compiler/syntax-kind.ts +188 -187
- package/src/compiler/thread-entry.ts +19 -2
- 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 +3 -0
- package/src/compiler/tsc-cli.ts +2 -0
- package/src/compiler/tsc-compile.ts +7 -2
- 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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// JSX: element and fragment types, the `JSX` namespace, intrinsic elements, attributes and children.
|
|
2
|
-
import {
|
|
3
|
-
import { getSymbol, getTagName, getText, getTypeArguments, getExpression, Identifier, PropertySignatureDeclaration, } from './ast.js';
|
|
2
|
+
import { checkDeprecatedSignature } from './checker-deprecation.js';
|
|
3
|
+
import { NodeVisitor, getSymbol, getTagName, getText, getTypeArguments, getExpression, Identifier, PropertySignatureDeclaration, } from './ast.js';
|
|
4
4
|
import { getSourceFileOfNode, getSourceTextOfNode } from './binder-utilities.js';
|
|
5
5
|
import { Diagnostic, chainDiagnostic } from './diagnostics.js';
|
|
6
6
|
import { JsxEmit } from './options.js';
|
|
@@ -94,7 +94,7 @@ function fileLinks(c, file) {
|
|
|
94
94
|
}
|
|
95
95
|
// ---- Syntax helpers
|
|
96
96
|
export function isJsxOpeningLikeElement(node) {
|
|
97
|
-
return node.kind ===
|
|
97
|
+
return node.kind === 288 /* SyntaxKind.JsxOpeningElement */ || node.kind === 287 /* SyntaxKind.JsxSelfClosingElement */;
|
|
98
98
|
}
|
|
99
99
|
function isIntrinsicJsxName(name) {
|
|
100
100
|
if (name.length === 0)
|
|
@@ -105,11 +105,11 @@ function isIntrinsicJsxName(name) {
|
|
|
105
105
|
/** Whether a tag name refers to an intrinsic element: a lowercase or dashed identifier, or `ns:name`. */
|
|
106
106
|
export function isJsxIntrinsicTagName(tagName) {
|
|
107
107
|
return ((tagName.kind === 79 /* SyntaxKind.Identifier */ && isIntrinsicJsxName(getText(tagName))) ||
|
|
108
|
-
tagName.kind ===
|
|
108
|
+
tagName.kind === 297 /* SyntaxKind.JsxNamespacedName */);
|
|
109
109
|
}
|
|
110
110
|
/** The text of an identifier or `ns:name`. */
|
|
111
111
|
function jsxNameText(node) {
|
|
112
|
-
if (node.kind ===
|
|
112
|
+
if (node.kind === 297 /* SyntaxKind.JsxNamespacedName */) {
|
|
113
113
|
const name = node;
|
|
114
114
|
return name.namespace.text + ':' + name.name.text;
|
|
115
115
|
}
|
|
@@ -122,13 +122,13 @@ function entityNameToString(node) {
|
|
|
122
122
|
switch (node.kind) {
|
|
123
123
|
case 109 /* SyntaxKind.ThisKeyword */:
|
|
124
124
|
return 'this';
|
|
125
|
-
case
|
|
125
|
+
case 213 /* SyntaxKind.PropertyAccessExpression */: {
|
|
126
126
|
const access = node;
|
|
127
127
|
return entityNameToString(access.expression) + '.' + entityNameToString(access.name);
|
|
128
128
|
}
|
|
129
|
-
case
|
|
130
|
-
return entityNameToString(node.left) + '.' + node.right
|
|
131
|
-
case
|
|
129
|
+
case 168 /* SyntaxKind.QualifiedName */:
|
|
130
|
+
return entityNameToString(node.left) + '.' + getText(node.right);
|
|
131
|
+
case 297 /* SyntaxKind.JsxNamespacedName */:
|
|
132
132
|
return jsxNameText(node);
|
|
133
133
|
}
|
|
134
134
|
return getText(node);
|
|
@@ -137,7 +137,7 @@ export function getTagNameOf(node) {
|
|
|
137
137
|
return getTagName(node);
|
|
138
138
|
}
|
|
139
139
|
export function getAttributesOf(node) {
|
|
140
|
-
return node.kind ===
|
|
140
|
+
return node.kind === 287 /* SyntaxKind.JsxSelfClosingElement */
|
|
141
141
|
? node.attributes
|
|
142
142
|
: node.attributes;
|
|
143
143
|
}
|
|
@@ -145,9 +145,9 @@ function getTypeArgumentListOf(node) {
|
|
|
145
145
|
return getTypeArguments(node);
|
|
146
146
|
}
|
|
147
147
|
function getChildrenOf(node) {
|
|
148
|
-
if (node.kind ===
|
|
148
|
+
if (node.kind === 286 /* SyntaxKind.JsxElement */)
|
|
149
149
|
return node.children.nodes;
|
|
150
|
-
if (node.kind ===
|
|
150
|
+
if (node.kind === 290 /* SyntaxKind.JsxFragment */)
|
|
151
151
|
return node.children.nodes;
|
|
152
152
|
return [];
|
|
153
153
|
}
|
|
@@ -155,7 +155,7 @@ function getChildrenOf(node) {
|
|
|
155
155
|
export function getSemanticJsxChildren(children) {
|
|
156
156
|
const result = [];
|
|
157
157
|
for (const child of children) {
|
|
158
|
-
if (child.kind ===
|
|
158
|
+
if (child.kind === 296 /* SyntaxKind.JsxExpression */) {
|
|
159
159
|
if (child.expression !== undefined)
|
|
160
160
|
result.push(child);
|
|
161
161
|
}
|
|
@@ -202,7 +202,7 @@ export function getJsxNamespace(c, location) {
|
|
|
202
202
|
if (location !== undefined) {
|
|
203
203
|
const file = getSourceFileOfNode(location);
|
|
204
204
|
const links = fileLinks(c, file);
|
|
205
|
-
if (location.kind ===
|
|
205
|
+
if (location.kind === 291 /* SyntaxKind.JsxOpeningFragment */) {
|
|
206
206
|
if (links.localJsxFragmentNamespace !== '')
|
|
207
207
|
return links.localJsxFragmentNamespace;
|
|
208
208
|
const fragmentPragma = getPragma(file, 'jsxfrag', 'factory');
|
|
@@ -293,12 +293,30 @@ export function getJsxNamespaceContainerForImplicitImport(c, location) {
|
|
|
293
293
|
links.jsxImplicitImportContainer = c.unknownSymbol;
|
|
294
294
|
return undefined;
|
|
295
295
|
}
|
|
296
|
-
|
|
296
|
+
// A missing module is reported once, at the first JSX tag of the file, whichever tag is checked first.
|
|
297
|
+
const finder = new FirstJsxTagFinder();
|
|
298
|
+
file.forEachChild(finder);
|
|
299
|
+
const mod = resolveExternalModule(c, specifier, getText(specifier), 1002 /* Diagnostics.This_JSX_tag_requires_the_module_path_0_to_exist_but_none_could_be_found_Make_sure_you_have_types_for_the_appropriate_package_installed */, finder.tag ?? location, false, undefined);
|
|
297
300
|
const resolved = mod !== undefined && mod !== c.unknownSymbol ? resolveSymbol(c, mod) : undefined;
|
|
298
301
|
const result = resolved !== undefined ? getMergedSymbol(c, resolved) : undefined;
|
|
299
302
|
links.jsxImplicitImportContainer = result ?? c.unknownSymbol;
|
|
300
303
|
return result;
|
|
301
304
|
}
|
|
305
|
+
/** The first JSX element or self-closing element of a file, or the opening tag of its first fragment. */
|
|
306
|
+
class FirstJsxTagFinder extends NodeVisitor {
|
|
307
|
+
tag = undefined;
|
|
308
|
+
visitNode(node) {
|
|
309
|
+
if (node.kind === 286 /* SyntaxKind.JsxElement */ || node.kind === 287 /* SyntaxKind.JsxSelfClosingElement */) {
|
|
310
|
+
this.tag = node;
|
|
311
|
+
return true;
|
|
312
|
+
}
|
|
313
|
+
if (node.kind === 290 /* SyntaxKind.JsxFragment */) {
|
|
314
|
+
this.tag = node.openingFragment;
|
|
315
|
+
return true;
|
|
316
|
+
}
|
|
317
|
+
return node.forEachChild(this);
|
|
318
|
+
}
|
|
319
|
+
}
|
|
302
320
|
/** The `JSX` namespace for `location`: the factory's, the runtime module's, or the global one. */
|
|
303
321
|
export function getJsxNamespaceAt(c, location) {
|
|
304
322
|
const links = elementLinks(c, location);
|
|
@@ -385,7 +403,7 @@ function getNameFromJsxElementAttributesContainer(c, containerName, ns) {
|
|
|
385
403
|
if (props.length === 1)
|
|
386
404
|
return props[0].name;
|
|
387
405
|
if (declarationCount(sym) !== 0)
|
|
388
|
-
c.error(sym.declaration,
|
|
406
|
+
c.error(sym.declaration, 759 /* Diagnostics.The_global_type_JSX_0_may_not_have_more_than_one_property */, containerName);
|
|
389
407
|
}
|
|
390
408
|
}
|
|
391
409
|
return "\uFFFEmissing" /* InternalSymbolName.Missing */;
|
|
@@ -431,12 +449,12 @@ export function getIntrinsicTagSymbol(c, node) {
|
|
|
431
449
|
links.resolvedSymbol = intrinsicElementsType.symbol ?? c.unknownSymbol;
|
|
432
450
|
return links.resolvedSymbol;
|
|
433
451
|
}
|
|
434
|
-
c.error(node,
|
|
452
|
+
c.error(node, 523 /* Diagnostics.Property_0_does_not_exist_on_type_1 */, propName, 'JSX.' + jsxIntrinsicElementsName);
|
|
435
453
|
links.resolvedSymbol = c.unknownSymbol;
|
|
436
454
|
return c.unknownSymbol;
|
|
437
455
|
}
|
|
438
456
|
if (c.noImplicitAny)
|
|
439
|
-
c.error(node,
|
|
457
|
+
c.error(node, 1716 /* Diagnostics.JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists */, jsxIntrinsicElementsName);
|
|
440
458
|
links.resolvedSymbol = c.unknownSymbol;
|
|
441
459
|
return c.unknownSymbol;
|
|
442
460
|
}
|
|
@@ -521,7 +539,7 @@ function getUninstantiatedJsxSignaturesOfType(c, elementType, caller) {
|
|
|
521
539
|
if ((elementType.flags & 1024 /* TypeFlags.StringLiteral */) !== 0) {
|
|
522
540
|
const intrinsicType = getIntrinsicAttributesTypeFromStringLiteralType(c, elementType, caller);
|
|
523
541
|
if (intrinsicType === undefined) {
|
|
524
|
-
c.error(caller,
|
|
542
|
+
c.error(caller, 523 /* Diagnostics.Property_0_does_not_exist_on_type_1 */, elementType.stringValue, 'JSX.' + jsxIntrinsicElementsName);
|
|
525
543
|
return [];
|
|
526
544
|
}
|
|
527
545
|
return [createSignatureForJSXIntrinsic(c, caller, intrinsicType)];
|
|
@@ -544,7 +562,7 @@ function getTypeOfFirstParameterOfSignatureWithFallback(c, sig, fallback) {
|
|
|
544
562
|
}
|
|
545
563
|
/** The props type a signature expects of an element's attributes. */
|
|
546
564
|
export function getEffectiveFirstArgumentForJsxSignature(c, signature, node) {
|
|
547
|
-
if (node.kind ===
|
|
565
|
+
if (node.kind === 291 /* SyntaxKind.JsxOpeningFragment */ || getJsxReferenceKind(c, node) !== 0 /* JsxReferenceKind.Component */)
|
|
548
566
|
return getJsxPropsTypeFromCallSignature(c, signature, node);
|
|
549
567
|
return getJsxPropsTypeFromClassType(c, signature, node);
|
|
550
568
|
}
|
|
@@ -567,7 +585,7 @@ function getJsxPropsTypeFromClassType(c, sig, context) {
|
|
|
567
585
|
else {
|
|
568
586
|
attributesType = getJsxPropsTypeForSignatureFromMember(c, sig, forcedLookupLocation);
|
|
569
587
|
if (attributesType === undefined && getAttributesOf(context).properties.nodes.length !== 0)
|
|
570
|
-
c.error(context,
|
|
588
|
+
c.error(context, 758 /* Diagnostics.JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property */, forcedLookupLocation);
|
|
571
589
|
}
|
|
572
590
|
if (attributesType === undefined)
|
|
573
591
|
return c.unknownType;
|
|
@@ -622,7 +640,7 @@ function getJsxManagedAttributesFromLocatedAttributes(c, context, ns, attributes
|
|
|
622
640
|
return attributesType;
|
|
623
641
|
}
|
|
624
642
|
function getStaticTypeOfReferencedJsxConstructor(c, context) {
|
|
625
|
-
if (context.kind ===
|
|
643
|
+
if (context.kind === 291 /* SyntaxKind.JsxOpeningFragment */)
|
|
626
644
|
return getJSXFragmentType(c, context);
|
|
627
645
|
const tagName = getTagNameOf(context);
|
|
628
646
|
if (isJsxIntrinsicTagName(tagName)) {
|
|
@@ -658,7 +676,7 @@ function getJSXFragmentType(c, node) {
|
|
|
658
676
|
let flags = 111551 /* SymbolFlags.Value */;
|
|
659
677
|
if (!shouldModuleRefErr)
|
|
660
678
|
flags &= ~384 /* SymbolFlags.Enum */;
|
|
661
|
-
jsxFactorySymbol = resolveName(c, node, jsxFragmentFactoryName, flags,
|
|
679
|
+
jsxFactorySymbol = resolveName(c, node, jsxFragmentFactoryName, flags, 1006 /* Diagnostics.Using_JSX_fragments_requires_fragment_factory_0_to_be_in_scope_but_it_could_not_be_found */, true, false);
|
|
662
680
|
}
|
|
663
681
|
if (jsxFactorySymbol === undefined) {
|
|
664
682
|
links.jsxFragmentType = c.errorType;
|
|
@@ -687,7 +705,7 @@ export function checkJsxChildren(c, node, checkMode) {
|
|
|
687
705
|
if (!child.containsOnlyTriviaWhiteSpaces)
|
|
688
706
|
childTypes.push(c.stringType);
|
|
689
707
|
}
|
|
690
|
-
else if (child.kind ===
|
|
708
|
+
else if (child.kind === 296 /* SyntaxKind.JsxExpression */ && child.expression === undefined)
|
|
691
709
|
continue;
|
|
692
710
|
else
|
|
693
711
|
childTypes.push(checkExpressionForMutableLocationEx(c, child, checkMode));
|
|
@@ -698,9 +716,9 @@ function parentHasSemanticJsxChildren(openingLikeElement) {
|
|
|
698
716
|
const parent = openingLikeElement.parent;
|
|
699
717
|
if (parent === undefined)
|
|
700
718
|
return false;
|
|
701
|
-
if (parent.kind ===
|
|
719
|
+
if (parent.kind === 286 /* SyntaxKind.JsxElement */ && parent.openingElement === openingLikeElement)
|
|
702
720
|
return getSemanticJsxChildren(parent.children.nodes).length !== 0;
|
|
703
|
-
if (parent.kind ===
|
|
721
|
+
if (parent.kind === 290 /* SyntaxKind.JsxFragment */ && parent.openingFragment === openingLikeElement)
|
|
704
722
|
return getSemanticJsxChildren(parent.children.nodes).length !== 0;
|
|
705
723
|
return false;
|
|
706
724
|
}
|
|
@@ -722,13 +740,13 @@ export function createJsxAttributesTypeFromAttributesProperty(c, openingLikeElem
|
|
|
722
740
|
let explicitlySpecifyChildrenAttribute = false;
|
|
723
741
|
let objectFlags = 2048 /* ObjectFlags.JsxAttributes */;
|
|
724
742
|
const jsxChildrenPropertyName = getJsxElementChildrenPropertyName(c, getJsxNamespaceAt(c, openingLikeElement));
|
|
725
|
-
if (openingLikeElement.kind !==
|
|
743
|
+
if (openingLikeElement.kind !== 291 /* SyntaxKind.JsxOpeningFragment */) {
|
|
726
744
|
const attributes = getAttributesOf(openingLikeElement);
|
|
727
745
|
attributesSymbol = attributes.symbol;
|
|
728
746
|
attributeParent = attributes;
|
|
729
747
|
const contextualType = getContextualType(c, attributes);
|
|
730
748
|
for (const attributeDecl of attributes.properties.nodes) {
|
|
731
|
-
if (attributeDecl.kind ===
|
|
749
|
+
if (attributeDecl.kind === 293 /* SyntaxKind.JsxAttribute */) {
|
|
732
750
|
const member = getSymbol(attributeDecl);
|
|
733
751
|
const exprType = checkJsxAttribute(c, attributeDecl, checkMode);
|
|
734
752
|
objectFlags |= exprType.objectFlags & 458752 /* ObjectFlags.PropagatingFlags */;
|
|
@@ -745,8 +763,6 @@ export function createJsxAttributesTypeFromAttributesProperty(c, openingLikeElem
|
|
|
745
763
|
allAttributesTable.set(attributeSymbol.name, attributeSymbol);
|
|
746
764
|
if (jsxNameText(attributeDecl.name) === jsxChildrenPropertyName)
|
|
747
765
|
explicitlySpecifyChildrenAttribute = true;
|
|
748
|
-
if (contextualType !== undefined)
|
|
749
|
-
checkDeprecatedJsxAttribute(c, contextualType, attributeDecl);
|
|
750
766
|
if (contextualType !== undefined &&
|
|
751
767
|
(checkMode & 2 /* CheckMode.Inferential */) !== 0 &&
|
|
752
768
|
(checkMode & 4 /* CheckMode.SkipContextSensitive */) === 0 &&
|
|
@@ -775,7 +791,7 @@ export function createJsxAttributesTypeFromAttributesProperty(c, openingLikeElem
|
|
|
775
791
|
checkSpreadPropOverrides(c, exprType, allAttributesTable, attributeDecl);
|
|
776
792
|
}
|
|
777
793
|
else {
|
|
778
|
-
c.error(expression,
|
|
794
|
+
c.error(expression, 837 /* Diagnostics.Spread_types_may_only_be_created_from_object_types */);
|
|
779
795
|
typeToIntersect =
|
|
780
796
|
typeToIntersect !== undefined ? getIntersectionType(c, [typeToIntersect, exprType]) : exprType;
|
|
781
797
|
}
|
|
@@ -791,9 +807,9 @@ export function createJsxAttributesTypeFromAttributesProperty(c, openingLikeElem
|
|
|
791
807
|
if (!hasSpreadAnyType && jsxChildrenPropertyName !== "\uFFFEmissing" /* InternalSymbolName.Missing */ && jsxChildrenPropertyName !== '') {
|
|
792
808
|
// Children overwrite a `children` attribute; one from a spread isn't reported.
|
|
793
809
|
if (explicitlySpecifyChildrenAttribute)
|
|
794
|
-
c.error(attributeParent,
|
|
810
|
+
c.error(attributeParent, 849 /* Diagnostics.X_0_are_specified_twice_The_attribute_named_0_will_be_overwritten */, jsxChildrenPropertyName);
|
|
795
811
|
let childrenContextualType = undefined;
|
|
796
|
-
if (openingLikeElement.kind ===
|
|
812
|
+
if (openingLikeElement.kind === 288 /* SyntaxKind.JsxOpeningElement */) {
|
|
797
813
|
const contextualType = getApparentTypeOfContextualType(c, getAttributesOf(openingLikeElement));
|
|
798
814
|
if (contextualType !== undefined)
|
|
799
815
|
childrenContextualType = getTypeOfPropertyOfContextualType(c, contextualType, jsxChildrenPropertyName);
|
|
@@ -843,7 +859,7 @@ export function isArrayOrTupleLikeType(c, t) {
|
|
|
843
859
|
export function getEffectiveJsxArguments(node) {
|
|
844
860
|
const attributes = getAttributesOf(node);
|
|
845
861
|
if (attributes.properties.nodes.length !== 0 ||
|
|
846
|
-
(node.kind ===
|
|
862
|
+
(node.kind === 288 /* SyntaxKind.JsxOpeningElement */ && node.parent.children.nodes.length !== 0))
|
|
847
863
|
return [attributes];
|
|
848
864
|
return [];
|
|
849
865
|
}
|
|
@@ -851,7 +867,7 @@ export function getEffectiveJsxArguments(node) {
|
|
|
851
867
|
export function checkApplicableSignatureForJsxCallLikeElement(c, node, signature, relation, checkMode, reportErrors, diagnosticOutput) {
|
|
852
868
|
// Function components get props, context and an updater; only props come from attributes.
|
|
853
869
|
const paramType = getEffectiveFirstArgumentForJsxSignature(c, signature, node);
|
|
854
|
-
const attributesType = node.kind ===
|
|
870
|
+
const attributesType = node.kind === 291 /* SyntaxKind.JsxOpeningFragment */
|
|
855
871
|
? createJsxAttributesTypeFromAttributesProperty(c, node, 0 /* CheckMode.Normal */)
|
|
856
872
|
: checkExpressionWithContextualType(c, getAttributesOf(node), paramType, undefined, checkMode);
|
|
857
873
|
const checkAttributesType = (checkMode & 4 /* CheckMode.SkipContextSensitive */) !== 0
|
|
@@ -860,11 +876,11 @@ export function checkApplicableSignatureForJsxCallLikeElement(c, node, signature
|
|
|
860
876
|
if (!checkTagNameDoesNotExpectTooManyArguments(c, node, reportErrors, diagnosticOutput))
|
|
861
877
|
return false;
|
|
862
878
|
const errorNode = reportErrors
|
|
863
|
-
? node.kind ===
|
|
879
|
+
? node.kind === 291 /* SyntaxKind.JsxOpeningFragment */
|
|
864
880
|
? node
|
|
865
881
|
: getTagNameOf(node)
|
|
866
882
|
: undefined;
|
|
867
|
-
const attributes = node.kind ===
|
|
883
|
+
const attributes = node.kind === 291 /* SyntaxKind.JsxOpeningFragment */ ? undefined : getAttributesOf(node);
|
|
868
884
|
return checkTypeRelatedToAndOptionallyElaborate(c, checkAttributesType, paramType, relation, errorNode, attributes, undefined, diagnosticOutput);
|
|
869
885
|
}
|
|
870
886
|
/** Whether a function component's required parameters fit what the factory passes it. */
|
|
@@ -872,7 +888,7 @@ function checkTagNameDoesNotExpectTooManyArguments(c, node, reportErrors, diagno
|
|
|
872
888
|
// The automatic runtime's factories aren't looked at.
|
|
873
889
|
if (getJsxNamespaceContainerForImplicitImport(c, node) !== undefined)
|
|
874
890
|
return true;
|
|
875
|
-
if (node.kind ===
|
|
891
|
+
if (node.kind === 291 /* SyntaxKind.JsxOpeningFragment */)
|
|
876
892
|
return true;
|
|
877
893
|
const tagName = getTagNameOf(node);
|
|
878
894
|
if (isJsxIntrinsicTagName(tagName))
|
|
@@ -911,10 +927,10 @@ function checkTagNameDoesNotExpectTooManyArguments(c, node, reportErrors, diagno
|
|
|
911
927
|
if (absoluteMinArgCount <= maxParamCount)
|
|
912
928
|
return true;
|
|
913
929
|
if (reportErrors) {
|
|
914
|
-
const diagnostic = createDiagnosticForNode(tagName,
|
|
930
|
+
const diagnostic = createDiagnosticForNode(tagName, 1392 /* Diagnostics.Tag_0_expects_at_least_1_arguments_but_the_JSX_factory_2_provides_at_most_3 */, [entityNameToString(tagName), String(absoluteMinArgCount), entityNameToString(factory), String(maxParamCount)]);
|
|
915
931
|
const tagNameSymbol = getSymbolOfTagName(c, tagName);
|
|
916
932
|
if (tagNameSymbol !== undefined && tagNameSymbol.valueDeclaration !== undefined)
|
|
917
|
-
diagnostic.addRelatedInfo(createDiagnosticForNode(tagNameSymbol.valueDeclaration,
|
|
933
|
+
diagnostic.addRelatedInfo(createDiagnosticForNode(tagNameSymbol.valueDeclaration, 867 /* Diagnostics.X_0_is_declared_here */, [
|
|
918
934
|
entityNameToString(tagName),
|
|
919
935
|
]));
|
|
920
936
|
reportDiagnostic(c, diagnostic, diagnosticOutput);
|
|
@@ -922,7 +938,7 @@ function checkTagNameDoesNotExpectTooManyArguments(c, node, reportErrors, diagno
|
|
|
922
938
|
return false;
|
|
923
939
|
}
|
|
924
940
|
function getSymbolOfTagName(c, tagName) {
|
|
925
|
-
if (tagName.kind === 79 /* SyntaxKind.Identifier */ || tagName.kind ===
|
|
941
|
+
if (tagName.kind === 79 /* SyntaxKind.Identifier */ || tagName.kind === 213 /* SyntaxKind.PropertyAccessExpression */)
|
|
926
942
|
return resolveEntityName(c, tagName, 111551 /* SymbolFlags.Value */, true, false, undefined);
|
|
927
943
|
return undefined;
|
|
928
944
|
}
|
|
@@ -933,7 +949,7 @@ function reportDiagnostic(c, diagnostic, output) {
|
|
|
933
949
|
c.addDiagnostic(diagnostic);
|
|
934
950
|
}
|
|
935
951
|
export function resolveJsxOpeningLikeElement(c, node, checkMode) {
|
|
936
|
-
const isJsxOpenFragment = node.kind ===
|
|
952
|
+
const isJsxOpenFragment = node.kind === 291 /* SyntaxKind.JsxOpeningFragment */;
|
|
937
953
|
let exprTypes;
|
|
938
954
|
if (!isJsxOpenFragment) {
|
|
939
955
|
const tagName = getTagNameOf(node);
|
|
@@ -947,7 +963,7 @@ export function resolveJsxOpeningLikeElement(c, node, checkMode) {
|
|
|
947
963
|
for (const t of typeArguments.nodes)
|
|
948
964
|
checkSourceElement(c, t);
|
|
949
965
|
const file = getSourceFileOfNode(node);
|
|
950
|
-
c.addDiagnostic(new Diagnostic(file.diagnosticFile(), skipTrivia(file.text, typeArguments.pos), typeArguments.end,
|
|
966
|
+
c.addDiagnostic(new Diagnostic(file.diagnosticFile(), skipTrivia(file.text, typeArguments.pos), typeArguments.end, 719 /* Diagnostics.Expected_0_type_arguments_but_got_1 */, ['0', String(typeArguments.nodes.length)]));
|
|
951
967
|
}
|
|
952
968
|
return fakeSignature;
|
|
953
969
|
}
|
|
@@ -963,7 +979,7 @@ export function resolveJsxOpeningLikeElement(c, node, checkMode) {
|
|
|
963
979
|
return resolveUntypedCall(c, node);
|
|
964
980
|
if (signatures.length === 0) {
|
|
965
981
|
const errorNode = isJsxOpenFragment ? node : getTagNameOf(node);
|
|
966
|
-
c.error(errorNode,
|
|
982
|
+
c.error(errorNode, 756 /* Diagnostics.JSX_element_type_0_does_not_have_any_construct_or_call_signatures */, getTextOfNode(errorNode));
|
|
967
983
|
return resolveErrorCall(c, node);
|
|
968
984
|
}
|
|
969
985
|
return resolveCall(c, node, signatures, checkMode, 0 /* SignatureFlags.None */, undefined);
|
|
@@ -984,7 +1000,7 @@ function isUntypedFunctionCall(c, funcType, apparentFuncType, numCallSignatures)
|
|
|
984
1000
|
isTypeAssignableTo(c, funcType, c.globalFunctionType));
|
|
985
1001
|
}
|
|
986
1002
|
function resolveUntypedCall(c, node) {
|
|
987
|
-
if (node.kind !==
|
|
1003
|
+
if (node.kind !== 291 /* SyntaxKind.JsxOpeningFragment */) {
|
|
988
1004
|
// Type arguments are checked even though an untyped element can't accept them: they get their
|
|
989
1005
|
// diagnostics and mark what they reference as used.
|
|
990
1006
|
const typeArguments = getTypeArgumentListOf(node);
|
|
@@ -1014,16 +1030,17 @@ export function inferJsxTypeArguments(c, node, signature, checkMode, context) {
|
|
|
1014
1030
|
/** Checks a JSX expression, element, fragment or attributes node. */
|
|
1015
1031
|
export function checkJsx(c, node, checkMode) {
|
|
1016
1032
|
switch (node.kind) {
|
|
1017
|
-
case
|
|
1033
|
+
case 296 /* SyntaxKind.JsxExpression */:
|
|
1018
1034
|
return checkJsxExpression(c, node, checkMode);
|
|
1019
|
-
case
|
|
1020
|
-
case
|
|
1035
|
+
case 286 /* SyntaxKind.JsxElement */:
|
|
1036
|
+
case 287 /* SyntaxKind.JsxSelfClosingElement */: {
|
|
1021
1037
|
checkNodeDeferred(c, node);
|
|
1022
1038
|
return getJsxElementTypeAt(c, node);
|
|
1023
1039
|
}
|
|
1024
|
-
case
|
|
1040
|
+
case 290 /* SyntaxKind.JsxFragment */:
|
|
1025
1041
|
return checkJsxFragment(c, node);
|
|
1026
|
-
case
|
|
1042
|
+
case 294 /* SyntaxKind.JsxAttributes */:
|
|
1043
|
+
checkNodeDeferred(c, node);
|
|
1027
1044
|
return createJsxAttributesTypeFromAttributesProperty(c, node.parent, checkMode);
|
|
1028
1045
|
}
|
|
1029
1046
|
return c.errorType;
|
|
@@ -1034,7 +1051,7 @@ function checkJsxExpression(c, node, checkMode) {
|
|
|
1034
1051
|
return c.errorType;
|
|
1035
1052
|
const t = checkExpressionEx(c, node.expression, checkMode);
|
|
1036
1053
|
if (node.dotDotDotToken !== undefined && t !== c.anyType && !isArrayType(c, t))
|
|
1037
|
-
c.error(node,
|
|
1054
|
+
c.error(node, 760 /* Diagnostics.JSX_spread_child_must_be_an_array_type */);
|
|
1038
1055
|
return t;
|
|
1039
1056
|
}
|
|
1040
1057
|
function checkJsxFragment(c, node) {
|
|
@@ -1049,15 +1066,15 @@ function checkJsxFragment(c, node) {
|
|
|
1049
1066
|
!hasFragmentFactory &&
|
|
1050
1067
|
getPragma(file, 'jsxfrag', 'factory') === undefined)
|
|
1051
1068
|
c.error(node, hasFactory
|
|
1052
|
-
?
|
|
1053
|
-
:
|
|
1069
|
+
? 1839 /* Diagnostics.The_jsxFragmentFactory_compiler_option_must_be_provided_to_use_JSX_fragments_with_the_jsxFactory_compiler_option */
|
|
1070
|
+
: 1840 /* Diagnostics.An_jsxFrag_pragma_is_required_when_using_an_jsx_pragma_with_JSX_fragments */);
|
|
1054
1071
|
checkJsxChildren(c, node, 0 /* CheckMode.Normal */);
|
|
1055
1072
|
const t = getJsxElementTypeAt(c, node);
|
|
1056
1073
|
return isErrorType(c, t) ? c.anyType : t;
|
|
1057
1074
|
}
|
|
1058
1075
|
/** The deferred check of an element: its signature, closing tag and children. */
|
|
1059
1076
|
export function checkJsxElementDeferred(c, node) {
|
|
1060
|
-
if (node.kind ===
|
|
1077
|
+
if (node.kind === 287 /* SyntaxKind.JsxSelfClosingElement */) {
|
|
1061
1078
|
checkJsxOpeningLikeElementOrOpeningFragment(c, node);
|
|
1062
1079
|
return;
|
|
1063
1080
|
}
|
|
@@ -1087,15 +1104,15 @@ function checkJsxOpeningLikeElementOrOpeningFragment(c, node) {
|
|
|
1087
1104
|
? getStringLiteralType(c, jsxNameText(tagName))
|
|
1088
1105
|
: checkExpression(c, tagName);
|
|
1089
1106
|
const diagnostics = [];
|
|
1090
|
-
if (!checkTypeRelatedTo(c, tagType, elementTypeConstraint, c.assignableRelation, tagName,
|
|
1091
|
-
c.addDiagnostic(chainDiagnostic(diagnostics[0],
|
|
1107
|
+
if (!checkTypeRelatedTo(c, tagType, elementTypeConstraint, c.assignableRelation, tagName, 1888 /* Diagnostics.Its_type_0_is_not_a_valid_JSX_element_type */, diagnostics))
|
|
1108
|
+
c.addDiagnostic(chainDiagnostic(diagnostics[0], 925 /* Diagnostics.X_0_cannot_be_used_as_a_JSX_component */, getTextOfNode(tagName)));
|
|
1092
1109
|
}
|
|
1093
1110
|
else
|
|
1094
1111
|
checkJsxReturnAssignableToAppropriateBound(c, getJsxReferenceKind(c, node), getReturnTypeOfSignature(c, sig), node);
|
|
1095
1112
|
}
|
|
1096
1113
|
function checkJsxPreconditions(c, errorNode) {
|
|
1097
1114
|
if (c.compilerOptions.jsx === undefined)
|
|
1098
|
-
c.error(errorNode,
|
|
1115
|
+
c.error(errorNode, 1827 /* Diagnostics.Cannot_use_JSX_unless_the_jsx_flag_is_provided */);
|
|
1099
1116
|
// A missing `JSX.Element` is the error type rather than absent, so TS2602 is never reported.
|
|
1100
1117
|
}
|
|
1101
1118
|
function checkJsxReturnAssignableToAppropriateBound(c, refKind, elemInstanceType, openingLikeElement) {
|
|
@@ -1104,12 +1121,12 @@ function checkJsxReturnAssignableToAppropriateBound(c, refKind, elemInstanceType
|
|
|
1104
1121
|
if (refKind === 1 /* JsxReferenceKind.Function */) {
|
|
1105
1122
|
const sfcReturnConstraint = getJsxStatelessElementTypeAt(c, openingLikeElement);
|
|
1106
1123
|
if (sfcReturnConstraint !== undefined)
|
|
1107
|
-
checkTypeRelatedTo(c, elemInstanceType, sfcReturnConstraint, c.assignableRelation, tagName,
|
|
1124
|
+
checkTypeRelatedTo(c, elemInstanceType, sfcReturnConstraint, c.assignableRelation, tagName, 926 /* Diagnostics.Its_return_type_0_is_not_a_valid_JSX_element */, diagnostics);
|
|
1108
1125
|
}
|
|
1109
1126
|
else if (refKind === 0 /* JsxReferenceKind.Component */) {
|
|
1110
1127
|
const classConstraint = getJsxElementClassTypeAt(c, openingLikeElement);
|
|
1111
1128
|
if (classConstraint !== undefined)
|
|
1112
|
-
checkTypeRelatedTo(c, elemInstanceType, classConstraint, c.assignableRelation, tagName,
|
|
1129
|
+
checkTypeRelatedTo(c, elemInstanceType, classConstraint, c.assignableRelation, tagName, 927 /* Diagnostics.Its_instance_type_0_is_not_a_valid_JSX_element */, diagnostics);
|
|
1113
1130
|
}
|
|
1114
1131
|
else {
|
|
1115
1132
|
const sfcReturnConstraint = getJsxStatelessElementTypeAt(c, openingLikeElement);
|
|
@@ -1117,17 +1134,17 @@ function checkJsxReturnAssignableToAppropriateBound(c, refKind, elemInstanceType
|
|
|
1117
1134
|
if (sfcReturnConstraint === undefined || classConstraint === undefined)
|
|
1118
1135
|
return;
|
|
1119
1136
|
const combined = getUnionType(c, [sfcReturnConstraint, classConstraint]);
|
|
1120
|
-
checkTypeRelatedTo(c, elemInstanceType, combined, c.assignableRelation, tagName,
|
|
1137
|
+
checkTypeRelatedTo(c, elemInstanceType, combined, c.assignableRelation, tagName, 928 /* Diagnostics.Its_element_type_0_is_not_a_valid_JSX_element */, diagnostics);
|
|
1121
1138
|
}
|
|
1122
1139
|
if (diagnostics.length !== 0)
|
|
1123
|
-
c.addDiagnostic(chainDiagnostic(diagnostics[0],
|
|
1140
|
+
c.addDiagnostic(chainDiagnostic(diagnostics[0], 925 /* Diagnostics.X_0_cannot_be_used_as_a_JSX_component */, getTextOfNode(tagName)));
|
|
1124
1141
|
}
|
|
1125
1142
|
/** Resolves the factory namespace, which must be in scope for the classic React transform. */
|
|
1126
1143
|
function markJsxAliasReferenced(c, node) {
|
|
1127
1144
|
if (getJsxNamespaceContainerForImplicitImport(c, node) !== undefined)
|
|
1128
1145
|
return;
|
|
1129
1146
|
const jsxFactoryRefErr = c.compilerOptions.jsx === JsxEmit.React
|
|
1130
|
-
?
|
|
1147
|
+
? 1001 /* Diagnostics.This_JSX_tag_requires_0_to_be_in_scope_but_it_could_not_be_found */
|
|
1131
1148
|
: undefined;
|
|
1132
1149
|
const jsxFactoryNamespace = getJsxNamespace(c, node);
|
|
1133
1150
|
const jsxFactoryLocation = isJsxOpeningLikeElement(node) ? getTagNameOf(node) : node;
|
|
@@ -1136,9 +1153,9 @@ function markJsxAliasReferenced(c, node) {
|
|
|
1136
1153
|
if (!shouldFactoryRefErr)
|
|
1137
1154
|
flags &= ~384 /* SymbolFlags.Enum */;
|
|
1138
1155
|
// `null` is allowed as the fragment factory.
|
|
1139
|
-
if (!(node.kind ===
|
|
1156
|
+
if (!(node.kind === 291 /* SyntaxKind.JsxOpeningFragment */ && jsxFactoryNamespace === 'null'))
|
|
1140
1157
|
resolveName(c, jsxFactoryLocation, jsxFactoryNamespace, flags, jsxFactoryRefErr, true, false);
|
|
1141
|
-
if (node.kind ===
|
|
1158
|
+
if (node.kind === 291 /* SyntaxKind.JsxOpeningFragment */) {
|
|
1142
1159
|
const file = getSourceFileOfNode(node);
|
|
1143
1160
|
const entity = getJsxFactoryEntity(c, file);
|
|
1144
1161
|
if (entity !== undefined)
|
|
@@ -1151,29 +1168,29 @@ function checkGrammarJsxElement(c, node) {
|
|
|
1151
1168
|
checkGrammarTypeArguments(c, node, getTypeArgumentListOf(node));
|
|
1152
1169
|
const seen = new Set();
|
|
1153
1170
|
for (const attrNode of getAttributesOf(node).properties.nodes) {
|
|
1154
|
-
if (attrNode.kind ===
|
|
1171
|
+
if (attrNode.kind === 295 /* SyntaxKind.JsxSpreadAttribute */)
|
|
1155
1172
|
continue;
|
|
1156
1173
|
const attr = attrNode;
|
|
1157
1174
|
const textOfName = jsxNameText(attr.name);
|
|
1158
1175
|
if (seen.has(textOfName))
|
|
1159
|
-
return grammarErrorOnNode(c, attr.name,
|
|
1176
|
+
return grammarErrorOnNode(c, attr.name, 1825 /* Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name */);
|
|
1160
1177
|
seen.add(textOfName);
|
|
1161
1178
|
const initializer = attr.initializer;
|
|
1162
1179
|
if (initializer !== undefined &&
|
|
1163
|
-
initializer.kind ===
|
|
1180
|
+
initializer.kind === 296 /* SyntaxKind.JsxExpression */ &&
|
|
1164
1181
|
initializer.expression === undefined)
|
|
1165
|
-
return grammarErrorOnNode(c, initializer,
|
|
1182
|
+
return grammarErrorOnNode(c, initializer, 1824 /* Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression */);
|
|
1166
1183
|
}
|
|
1167
1184
|
return false;
|
|
1168
1185
|
}
|
|
1169
1186
|
function checkGrammarJsxName(c, node) {
|
|
1170
|
-
if (node.kind ===
|
|
1171
|
-
node.expression.kind ===
|
|
1172
|
-
return grammarErrorOnNode(c, node.expression,
|
|
1173
|
-
if (node.kind ===
|
|
1187
|
+
if (node.kind === 213 /* SyntaxKind.PropertyAccessExpression */ &&
|
|
1188
|
+
node.expression.kind === 297 /* SyntaxKind.JsxNamespacedName */)
|
|
1189
|
+
return grammarErrorOnNode(c, node.expression, 783 /* Diagnostics.JSX_property_access_expressions_cannot_include_JSX_namespace_names */);
|
|
1190
|
+
if (node.kind === 297 /* SyntaxKind.JsxNamespacedName */ &&
|
|
1174
1191
|
isJsxTransformEnabled(c) &&
|
|
1175
1192
|
!isIntrinsicJsxName(node.namespace.text))
|
|
1176
|
-
return grammarErrorOnNode(c, node,
|
|
1193
|
+
return grammarErrorOnNode(c, node, 789 /* Diagnostics.React_components_cannot_include_JSX_namespace_names */);
|
|
1177
1194
|
return false;
|
|
1178
1195
|
}
|
|
1179
1196
|
function checkGrammarTypeArguments(c, node, typeArguments) {
|
|
@@ -1192,23 +1209,23 @@ function checkGrammarTypeArguments(c, node, typeArguments) {
|
|
|
1192
1209
|
function checkGrammarJsxExpression(c, node) {
|
|
1193
1210
|
const expression = node.expression;
|
|
1194
1211
|
if (expression !== undefined &&
|
|
1195
|
-
expression.kind ===
|
|
1212
|
+
expression.kind === 228 /* SyntaxKind.BinaryExpression */ &&
|
|
1196
1213
|
expression.operatorToken.kind === 27 /* SyntaxKind.CommaToken */)
|
|
1197
|
-
return grammarErrorOnNode(c, expression,
|
|
1214
|
+
return grammarErrorOnNode(c, expression, 1850 /* Diagnostics.JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array */);
|
|
1198
1215
|
return false;
|
|
1199
1216
|
}
|
|
1200
1217
|
// ---- Contextual types
|
|
1201
1218
|
export function getContextualTypeForJsxExpression(c, node, contextFlags) {
|
|
1202
1219
|
const parent = node.parent;
|
|
1203
|
-
if (parent.kind ===
|
|
1220
|
+
if (parent.kind === 293 /* SyntaxKind.JsxAttribute */ || parent.kind === 295 /* SyntaxKind.JsxSpreadAttribute */)
|
|
1204
1221
|
return getContextualTypeEx(c, node, contextFlags);
|
|
1205
|
-
if (parent.kind ===
|
|
1222
|
+
if (parent.kind === 286 /* SyntaxKind.JsxElement */)
|
|
1206
1223
|
return getContextualTypeForChildJsxExpression(c, parent, node, contextFlags);
|
|
1207
1224
|
return undefined;
|
|
1208
1225
|
}
|
|
1209
1226
|
export function getContextualTypeForJsxAttribute(c, attribute, contextFlags) {
|
|
1210
1227
|
// While a function component's signature is tried, its attributes carry the parameter type.
|
|
1211
|
-
if (attribute.kind ===
|
|
1228
|
+
if (attribute.kind === 293 /* SyntaxKind.JsxAttribute */) {
|
|
1212
1229
|
const attributesType = getApparentTypeOfContextualTypeEx(c, attribute.parent, contextFlags);
|
|
1213
1230
|
if (attributesType === undefined || (attributesType.flags & 1 /* TypeFlags.Any */) !== 0)
|
|
1214
1231
|
return undefined;
|
|
@@ -1217,7 +1234,7 @@ export function getContextualTypeForJsxAttribute(c, attribute, contextFlags) {
|
|
|
1217
1234
|
return getContextualTypeEx(c, attribute.parent, contextFlags);
|
|
1218
1235
|
}
|
|
1219
1236
|
export function getContextualJsxElementAttributesType(c, node, contextFlags) {
|
|
1220
|
-
if (node.kind ===
|
|
1237
|
+
if (node.kind === 288 /* SyntaxKind.JsxOpeningElement */) {
|
|
1221
1238
|
// Contextual types of an element's attributes are pushed onto the element, which spans the children.
|
|
1222
1239
|
// Cached contextual types were obtained without flags.
|
|
1223
1240
|
const index = findContextualNode(c, node.parent, contextFlags === 0 /* ContextFlags.None */);
|
|
@@ -1252,7 +1269,7 @@ export function isJsxAttributesContextSensitive(c, node) {
|
|
|
1252
1269
|
for (const p of node.properties.nodes)
|
|
1253
1270
|
if (isContextSensitive(c, p))
|
|
1254
1271
|
return true;
|
|
1255
|
-
if (node.parent.kind ===
|
|
1272
|
+
if (node.parent.kind === 288 /* SyntaxKind.JsxOpeningElement */)
|
|
1256
1273
|
for (const child of node.parent.parent.children.nodes)
|
|
1257
1274
|
if (isContextSensitive(c, child))
|
|
1258
1275
|
return true;
|
|
@@ -1276,7 +1293,7 @@ class JsxElaborationElement {
|
|
|
1276
1293
|
}
|
|
1277
1294
|
function getElaborationElementForJsxChild(child, nameType) {
|
|
1278
1295
|
switch (child.kind) {
|
|
1279
|
-
case
|
|
1296
|
+
case 296 /* SyntaxKind.JsxExpression */:
|
|
1280
1297
|
return new JsxElaborationElement(child, child.expression, nameType, false);
|
|
1281
1298
|
case 11 /* SyntaxKind.JsxText */:
|
|
1282
1299
|
// Whitespace-only text isn't a child.
|
|
@@ -1290,7 +1307,7 @@ function getElaborationElementForJsxChild(child, nameType) {
|
|
|
1290
1307
|
export function elaborateJsxComponents(c, node, source, target, relation, diagnosticOutput) {
|
|
1291
1308
|
let reportedError = false;
|
|
1292
1309
|
for (const prop of node.properties.nodes) {
|
|
1293
|
-
if (prop.kind ===
|
|
1310
|
+
if (prop.kind === 295 /* SyntaxKind.JsxSpreadAttribute */)
|
|
1294
1311
|
continue;
|
|
1295
1312
|
const attr = prop;
|
|
1296
1313
|
const name = jsxNameText(attr.name);
|
|
@@ -1301,7 +1318,7 @@ export function elaborateJsxComponents(c, node, source, target, relation, diagno
|
|
|
1301
1318
|
elaborateElement(c, source, target, relation, attr.name, attr.initializer, nameType, undefined, undefined, [], diagnosticOutput) || reportedError;
|
|
1302
1319
|
}
|
|
1303
1320
|
const opening = node.parent;
|
|
1304
|
-
if (opening.kind !==
|
|
1321
|
+
if (opening.kind !== 288 /* SyntaxKind.JsxOpeningElement */ || opening.parent.kind !== 286 /* SyntaxKind.JsxElement */)
|
|
1305
1322
|
return reportedError;
|
|
1306
1323
|
const containingElement = opening.parent;
|
|
1307
1324
|
let childrenPropName = getJsxElementChildrenPropertyName(c, getJsxNamespaceAt(c, node));
|
|
@@ -1325,9 +1342,9 @@ export function elaborateJsxComponents(c, node, source, target, relation, diagno
|
|
|
1325
1342
|
arrayLikeTargetParts = filterType(c, childrenTargetType, (t) => isArrayOrTupleLikeType(c, t));
|
|
1326
1343
|
nonArrayLikeTargetParts = filterType(c, childrenTargetType, (t) => !isArrayOrTupleLikeType(c, t));
|
|
1327
1344
|
}
|
|
1328
|
-
const textMessage =
|
|
1345
|
+
const textMessage = 886 /* Diagnostics.X_0_components_don_t_accept_text_as_child_elements_Text_in_JSX_has_the_type_string_but_the_expected_type_of_1_is_2 */;
|
|
1329
1346
|
const textArgs = [
|
|
1330
|
-
getTextOfNode(opening.kind ===
|
|
1347
|
+
getTextOfNode(opening.kind === 288 /* SyntaxKind.JsxOpeningElement */ ? getTagNameOf(opening) : opening),
|
|
1331
1348
|
childrenPropName,
|
|
1332
1349
|
typeToString(c, childrenTargetType),
|
|
1333
1350
|
];
|
|
@@ -1349,7 +1366,7 @@ export function elaborateJsxComponents(c, node, source, target, relation, diagno
|
|
|
1349
1366
|
}
|
|
1350
1367
|
else if (!isTypeRelatedTo(c, getIndexedAccessType(c, source, childrenNameType), childrenTargetType, relation)) {
|
|
1351
1368
|
// Arity errors are reported both directly and through the output.
|
|
1352
|
-
const diagnostic = c.error(containingElement.openingElement.tagName,
|
|
1369
|
+
const diagnostic = c.error(containingElement.openingElement.tagName, 885 /* Diagnostics.This_JSX_tag_s_0_prop_expects_a_single_child_of_type_1_but_multiple_children_were_provided */, childrenPropName, typeToString(c, childrenTargetType));
|
|
1353
1370
|
reportDiagnostic(c, diagnostic, diagnosticOutput);
|
|
1354
1371
|
reportedError = true;
|
|
1355
1372
|
}
|
|
@@ -1361,7 +1378,7 @@ export function elaborateJsxComponents(c, node, source, target, relation, diagno
|
|
|
1361
1378
|
elaborateElement(c, source, target, relation, e.errorNode, e.innerExpression, e.nameType, undefined, e.isText ? textMessage : undefined, textArgs, diagnosticOutput) || reportedError;
|
|
1362
1379
|
}
|
|
1363
1380
|
else if (!isTypeRelatedTo(c, getIndexedAccessType(c, source, childrenNameType), childrenTargetType, relation)) {
|
|
1364
|
-
const diagnostic = c.error(containingElement.openingElement.tagName,
|
|
1381
|
+
const diagnostic = c.error(containingElement.openingElement.tagName, 884 /* Diagnostics.This_JSX_tag_s_0_prop_expects_type_1_which_requires_multiple_children_but_only_a_single_child_was_provided */, childrenPropName, typeToString(c, childrenTargetType));
|
|
1365
1382
|
reportDiagnostic(c, diagnostic, diagnosticOutput);
|
|
1366
1383
|
reportedError = true;
|
|
1367
1384
|
}
|
|
@@ -1405,7 +1422,7 @@ function elaborateIterableOrArrayLikeTargetElementwise(c, elements, source, targ
|
|
|
1405
1422
|
continue;
|
|
1406
1423
|
}
|
|
1407
1424
|
if (c.exactOptionalPropertyTypes && isExactOptionalPropertyMismatch(c, specificSource, targetPropType)) {
|
|
1408
|
-
reportDiagnostic(c, createDiagnosticForNode(e.errorNode,
|
|
1425
|
+
reportDiagnostic(c, createDiagnosticForNode(e.errorNode, 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)]), diagnosticOutput);
|
|
1409
1426
|
continue;
|
|
1410
1427
|
}
|
|
1411
1428
|
const propName = getPropertyNameFromIndex(e.nameType);
|