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