tsc-ts 0.0.3 → 0.0.5
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 +46 -0
- package/dist/api/compiler/ast-utilities.d.ts +82 -0
- package/dist/api/compiler/ast-utilities.js +462 -0
- package/dist/api/compiler/ast.d.ts +2350 -0
- package/dist/api/compiler/ast.js +11206 -0
- package/dist/api/compiler/astnav.d.ts +37 -0
- package/dist/api/compiler/astnav.js +767 -0
- package/dist/api/compiler/binder-utilities.d.ts +182 -0
- package/dist/api/compiler/binder-utilities.js +1240 -0
- package/dist/api/compiler/binder.d.ts +33 -0
- package/dist/api/compiler/binder.js +2358 -0
- package/dist/api/compiler/character-codes.d.ts +161 -0
- package/dist/api/compiler/character-codes.js +160 -0
- package/dist/api/compiler/checker-calls.d.ts +46 -0
- package/dist/api/compiler/checker-calls.js +1640 -0
- package/dist/api/compiler/checker-classes.d.ts +30 -0
- package/dist/api/compiler/checker-classes.js +582 -0
- package/dist/api/compiler/checker-contextual.d.ts +77 -0
- package/dist/api/compiler/checker-contextual.js +1136 -0
- package/dist/api/compiler/checker-declaration-order.d.ts +12 -0
- package/dist/api/compiler/checker-declaration-order.js +356 -0
- package/dist/api/compiler/checker-declarations.d.ts +33 -0
- package/dist/api/compiler/checker-declarations.js +888 -0
- package/dist/api/compiler/checker-declared-types.d.ts +48 -0
- package/dist/api/compiler/checker-declared-types.js +787 -0
- package/dist/api/compiler/checker-decorators.d.ts +26 -0
- package/dist/api/compiler/checker-decorators.js +562 -0
- package/dist/api/compiler/checker-deprecation.d.ts +33 -0
- package/dist/api/compiler/checker-deprecation.js +315 -0
- package/dist/api/compiler/checker-destructuring.d.ts +34 -0
- package/dist/api/compiler/checker-destructuring.js +584 -0
- package/dist/api/compiler/checker-elaboration.d.ts +15 -0
- package/dist/api/compiler/checker-elaboration.js +290 -0
- package/dist/api/compiler/checker-emit-helpers.d.ts +58 -0
- package/dist/api/compiler/checker-emit-helpers.js +154 -0
- package/dist/api/compiler/checker-emit-resolver.d.ts +75 -0
- package/dist/api/compiler/checker-emit-resolver.js +579 -0
- package/dist/api/compiler/checker-evaluator.d.ts +27 -0
- package/dist/api/compiler/checker-evaluator.js +188 -0
- package/dist/api/compiler/checker-expressions.d.ts +67 -0
- package/dist/api/compiler/checker-expressions.js +1351 -0
- package/dist/api/compiler/checker-features.d.ts +6 -0
- package/dist/api/compiler/checker-features.js +354 -0
- package/dist/api/compiler/checker-flow.d.ts +86 -0
- package/dist/api/compiler/checker-flow.js +169 -0
- package/dist/api/compiler/checker-functions.d.ts +43 -0
- package/dist/api/compiler/checker-functions.js +1002 -0
- package/dist/api/compiler/checker-generated-code.d.ts +25 -0
- package/dist/api/compiler/checker-generated-code.js +168 -0
- package/dist/api/compiler/checker-globals.d.ts +14 -0
- package/dist/api/compiler/checker-globals.js +37 -0
- package/dist/api/compiler/checker-grammar.d.ts +35 -0
- package/dist/api/compiler/checker-grammar.js +2573 -0
- package/dist/api/compiler/checker-heritage.d.ts +28 -0
- package/dist/api/compiler/checker-heritage.js +900 -0
- package/dist/api/compiler/checker-inference.d.ts +179 -0
- package/dist/api/compiler/checker-inference.js +2105 -0
- package/dist/api/compiler/checker-iteration.d.ts +115 -0
- package/dist/api/compiler/checker-iteration.js +857 -0
- package/dist/api/compiler/checker-javascript.d.ts +42 -0
- package/dist/api/compiler/checker-javascript.js +441 -0
- package/dist/api/compiler/checker-jsdoc.d.ts +30 -0
- package/dist/api/compiler/checker-jsdoc.js +320 -0
- package/dist/api/compiler/checker-jsx.d.ts +94 -0
- package/dist/api/compiler/checker-jsx.js +1433 -0
- package/dist/api/compiler/checker-literals.d.ts +6 -0
- package/dist/api/compiler/checker-literals.js +43 -0
- package/dist/api/compiler/checker-members.d.ts +198 -0
- package/dist/api/compiler/checker-members.js +2126 -0
- package/dist/api/compiler/checker-modules.d.ts +85 -0
- package/dist/api/compiler/checker-modules.js +2141 -0
- package/dist/api/compiler/checker-narrowing.d.ts +120 -0
- package/dist/api/compiler/checker-narrowing.js +2797 -0
- package/dist/api/compiler/checker-object-literals.d.ts +14 -0
- package/dist/api/compiler/checker-object-literals.js +479 -0
- package/dist/api/compiler/checker-operators.d.ts +33 -0
- package/dist/api/compiler/checker-operators.js +1040 -0
- package/dist/api/compiler/checker-overloads.d.ts +7 -0
- package/dist/api/compiler/checker-overloads.js +270 -0
- package/dist/api/compiler/checker-property-access.d.ts +34 -0
- package/dist/api/compiler/checker-property-access.js +672 -0
- package/dist/api/compiler/checker-services.d.ts +49 -0
- package/dist/api/compiler/checker-services.js +995 -0
- package/dist/api/compiler/checker-signatures.d.ts +55 -0
- package/dist/api/compiler/checker-signatures.js +788 -0
- package/dist/api/compiler/checker-source-file.d.ts +27 -0
- package/dist/api/compiler/checker-source-file.js +619 -0
- package/dist/api/compiler/checker-statements.d.ts +18 -0
- package/dist/api/compiler/checker-statements.js +226 -0
- package/dist/api/compiler/checker-super.d.ts +13 -0
- package/dist/api/compiler/checker-super.js +241 -0
- package/dist/api/compiler/checker-symbol-types.d.ts +67 -0
- package/dist/api/compiler/checker-symbol-types.js +1885 -0
- package/dist/api/compiler/checker-symbols.d.ts +181 -0
- package/dist/api/compiler/checker-symbols.js +1782 -0
- package/dist/api/compiler/checker-type-factory.d.ts +142 -0
- package/dist/api/compiler/checker-type-factory.js +2501 -0
- package/dist/api/compiler/checker-type-nodes.d.ts +26 -0
- package/dist/api/compiler/checker-type-nodes.js +828 -0
- package/dist/api/compiler/checker-type-operators.d.ts +109 -0
- package/dist/api/compiler/checker-type-operators.js +1842 -0
- package/dist/api/compiler/checker-types.d.ts +1027 -0
- package/dist/api/compiler/checker-types.js +1697 -0
- package/dist/api/compiler/checker-unused.d.ts +19 -0
- package/dist/api/compiler/checker-unused.js +524 -0
- package/dist/api/compiler/checker-utilities.d.ts +33 -0
- package/dist/api/compiler/checker-utilities.js +141 -0
- package/dist/api/compiler/checker.d.ts +491 -0
- package/dist/api/compiler/checker.js +912 -0
- package/dist/api/compiler/command-line.d.ts +32 -0
- package/dist/api/compiler/command-line.js +383 -0
- package/dist/api/compiler/compile-program.d.ts +118 -0
- package/dist/api/compiler/compile-program.js +384 -0
- package/dist/api/compiler/diagnostic-locales.d.ts +22 -0
- package/dist/api/compiler/diagnostic-locales.js +64 -0
- package/dist/api/compiler/diagnostic-messages.d.ts +2166 -0
- package/dist/api/compiler/diagnostic-messages.js +184 -0
- package/dist/api/compiler/diagnostics.d.ts +167 -0
- package/dist/api/compiler/diagnostics.js +820 -0
- package/dist/api/compiler/emitter.d.ts +71 -0
- package/dist/api/compiler/emitter.js +327 -0
- package/dist/api/compiler/file-include.d.ts +117 -0
- package/dist/api/compiler/file-include.js +536 -0
- package/dist/api/compiler/file-loader.d.ts +261 -0
- package/dist/api/compiler/file-loader.js +1257 -0
- package/dist/api/compiler/file-system.d.ts +51 -0
- package/dist/api/compiler/file-system.js +132 -0
- package/dist/api/compiler/flow.d.ts +60 -0
- package/dist/api/compiler/flow.js +45 -0
- package/dist/api/compiler/instantiation.d.ts +74 -0
- package/dist/api/compiler/instantiation.js +799 -0
- package/dist/api/compiler/jsdoc.d.ts +75 -0
- package/dist/api/compiler/jsdoc.js +1229 -0
- package/dist/api/compiler/link-tables.d.ts +36 -0
- package/dist/api/compiler/link-tables.js +83 -0
- package/dist/api/compiler/locale-data.d.ts +24 -0
- package/dist/api/compiler/locale-data.js +183 -0
- package/dist/api/compiler/locale.d.ts +4 -0
- package/dist/api/compiler/locale.js +317 -0
- package/dist/api/compiler/locales/cs-CZ.d.ts +2 -0
- package/dist/api/compiler/locales/cs-CZ.js +3 -0
- package/dist/api/compiler/locales/de-DE.d.ts +2 -0
- package/dist/api/compiler/locales/de-DE.js +3 -0
- package/dist/api/compiler/locales/es-ES.d.ts +2 -0
- package/dist/api/compiler/locales/es-ES.js +3 -0
- package/dist/api/compiler/locales/fr-FR.d.ts +2 -0
- package/dist/api/compiler/locales/fr-FR.js +3 -0
- package/dist/api/compiler/locales/it-IT.d.ts +2 -0
- package/dist/api/compiler/locales/it-IT.js +3 -0
- package/dist/api/compiler/locales/ja-JP.d.ts +2 -0
- package/dist/api/compiler/locales/ja-JP.js +3 -0
- package/dist/api/compiler/locales/ko-KR.d.ts +2 -0
- package/dist/api/compiler/locales/ko-KR.js +3 -0
- package/dist/api/compiler/locales/pl-PL.d.ts +2 -0
- package/dist/api/compiler/locales/pl-PL.js +3 -0
- package/dist/api/compiler/locales/pt-BR.d.ts +2 -0
- package/dist/api/compiler/locales/pt-BR.js +3 -0
- package/dist/api/compiler/locales/ru-RU.d.ts +2 -0
- package/dist/api/compiler/locales/ru-RU.js +3 -0
- package/dist/api/compiler/locales/tr-TR.d.ts +2 -0
- package/dist/api/compiler/locales/tr-TR.js +3 -0
- package/dist/api/compiler/locales/zh-CN.d.ts +2 -0
- package/dist/api/compiler/locales/zh-CN.js +3 -0
- package/dist/api/compiler/locales/zh-TW.d.ts +2 -0
- package/dist/api/compiler/locales/zh-TW.js +3 -0
- package/dist/api/compiler/module-resolution-types.d.ts +83 -0
- package/dist/api/compiler/module-resolution-types.js +176 -0
- package/dist/api/compiler/module-resolution.d.ts +71 -0
- package/dist/api/compiler/module-resolution.js +1598 -0
- package/dist/api/compiler/module-specifiers.d.ts +64 -0
- package/dist/api/compiler/module-specifiers.js +1101 -0
- package/dist/api/compiler/name-resolver.d.ts +43 -0
- package/dist/api/compiler/name-resolver.js +509 -0
- package/dist/api/compiler/node-builder-names.d.ts +32 -0
- package/dist/api/compiler/node-builder-names.js +854 -0
- package/dist/api/compiler/node-builder-pseudo.d.ts +36 -0
- package/dist/api/compiler/node-builder-pseudo.js +744 -0
- package/dist/api/compiler/node-builder-reuse.d.ts +4 -0
- package/dist/api/compiler/node-builder-reuse.js +647 -0
- package/dist/api/compiler/node-builder.d.ts +270 -0
- package/dist/api/compiler/node-builder.js +2645 -0
- package/dist/api/compiler/option-declarations.d.ts +90 -0
- package/dist/api/compiler/option-declarations.js +1460 -0
- package/dist/api/compiler/options.d.ts +289 -0
- package/dist/api/compiler/options.js +1197 -0
- package/dist/api/compiler/output-paths.d.ts +42 -0
- package/dist/api/compiler/output-paths.js +195 -0
- package/dist/api/compiler/package-json.d.ts +175 -0
- package/dist/api/compiler/package-json.js +1015 -0
- package/dist/api/compiler/parallel-parse.d.ts +219 -0
- package/dist/api/compiler/parallel-parse.js +537 -0
- package/dist/api/compiler/parser.d.ts +587 -0
- package/dist/api/compiler/parser.js +6407 -0
- package/dist/api/compiler/path.d.ts +91 -0
- package/dist/api/compiler/path.js +705 -0
- package/dist/api/compiler/printer/async-helpers.d.ts +22 -0
- package/dist/api/compiler/printer/async-helpers.js +91 -0
- package/dist/api/compiler/printer/auto-generate.d.ts +13 -0
- package/dist/api/compiler/printer/auto-generate.js +20 -0
- package/dist/api/compiler/printer/decorator-helpers.d.ts +24 -0
- package/dist/api/compiler/printer/decorator-helpers.js +118 -0
- package/dist/api/compiler/printer/emit-context.d.ts +154 -0
- package/dist/api/compiler/printer/emit-context.js +576 -0
- package/dist/api/compiler/printer/emit-flags.d.ts +60 -0
- package/dist/api/compiler/printer/emit-flags.js +2 -0
- package/dist/api/compiler/printer/factory-base.d.ts +171 -0
- package/dist/api/compiler/printer/factory-base.js +1505 -0
- package/dist/api/compiler/printer/factory.d.ts +147 -0
- package/dist/api/compiler/printer/factory.js +542 -0
- package/dist/api/compiler/printer/helpers.d.ts +27 -0
- package/dist/api/compiler/printer/helpers.js +164 -0
- package/dist/api/compiler/printer/name-generator.d.ts +41 -0
- package/dist/api/compiler/printer/name-generator.js +283 -0
- package/dist/api/compiler/printer/printer.d.ts +411 -0
- package/dist/api/compiler/printer/printer.js +4517 -0
- package/dist/api/compiler/printer/text-writer.d.ts +46 -0
- package/dist/api/compiler/printer/text-writer.js +172 -0
- package/dist/api/compiler/printer/utilities.d.ts +82 -0
- package/dist/api/compiler/printer/utilities.js +817 -0
- package/dist/api/compiler/program-checker.d.ts +156 -0
- package/dist/api/compiler/program-checker.js +526 -0
- package/dist/api/compiler/program-utilities.d.ts +52 -0
- package/dist/api/compiler/program-utilities.js +365 -0
- package/dist/api/compiler/program.d.ts +180 -0
- package/dist/api/compiler/program.js +1011 -0
- package/dist/api/compiler/pseudo-bigint.d.ts +5 -0
- package/dist/api/compiler/pseudo-bigint.js +61 -0
- package/dist/api/compiler/regexp-checker.d.ts +38 -0
- package/dist/api/compiler/regexp-checker.js +942 -0
- package/dist/api/compiler/relations.d.ts +263 -0
- package/dist/api/compiler/relations.js +4002 -0
- package/dist/api/compiler/reparser.d.ts +48 -0
- package/dist/api/compiler/reparser.js +1323 -0
- package/dist/api/compiler/scanner.d.ts +256 -0
- package/dist/api/compiler/scanner.js +2853 -0
- package/dist/api/compiler/side-state.d.ts +16 -0
- package/dist/api/compiler/side-state.js +89 -0
- package/dist/api/compiler/sourcemap.d.ts +55 -0
- package/dist/api/compiler/sourcemap.js +340 -0
- package/dist/api/compiler/spelling.d.ts +14 -0
- package/dist/api/compiler/spelling.js +128 -0
- package/dist/api/compiler/symbol-accessibility.d.ts +57 -0
- package/dist/api/compiler/symbol-accessibility.js +894 -0
- package/dist/api/compiler/symbol.d.ts +240 -0
- package/dist/api/compiler/symbol.js +228 -0
- package/dist/api/compiler/symlinks.d.ts +32 -0
- package/dist/api/compiler/symlinks.js +114 -0
- package/dist/api/compiler/syntax-kind.d.ts +389 -0
- package/dist/api/compiler/syntax-kind.js +2 -0
- package/dist/api/compiler/timeline.d.ts +9 -0
- package/dist/api/compiler/timeline.js +54 -0
- package/dist/api/compiler/transformers/alias-references.d.ts +39 -0
- package/dist/api/compiler/transformers/alias-references.js +676 -0
- package/dist/api/compiler/transformers/async-utilities.d.ts +51 -0
- package/dist/api/compiler/transformers/async-utilities.js +260 -0
- package/dist/api/compiler/transformers/async.d.ts +53 -0
- package/dist/api/compiler/transformers/async.js +645 -0
- package/dist/api/compiler/transformers/class-fields.d.ts +206 -0
- package/dist/api/compiler/transformers/class-fields.js +2418 -0
- package/dist/api/compiler/transformers/class-utilities.d.ts +46 -0
- package/dist/api/compiler/transformers/class-utilities.js +261 -0
- package/dist/api/compiler/transformers/commonjs-module.d.ts +103 -0
- package/dist/api/compiler/transformers/commonjs-module.js +1180 -0
- package/dist/api/compiler/transformers/const-enum-inliner.d.ts +11 -0
- package/dist/api/compiler/transformers/const-enum-inliner.js +36 -0
- package/dist/api/compiler/transformers/declarations-diagnostics.d.ts +52 -0
- package/dist/api/compiler/transformers/declarations-diagnostics.js +538 -0
- package/dist/api/compiler/transformers/declarations-pseudo.d.ts +160 -0
- package/dist/api/compiler/transformers/declarations-pseudo.js +797 -0
- package/dist/api/compiler/transformers/declarations-resolver.d.ts +152 -0
- package/dist/api/compiler/transformers/declarations-resolver.js +35 -0
- package/dist/api/compiler/transformers/declarations-syntactic.d.ts +119 -0
- package/dist/api/compiler/transformers/declarations-syntactic.js +1582 -0
- package/dist/api/compiler/transformers/declarations-tracker.d.ts +46 -0
- package/dist/api/compiler/transformers/declarations-tracker.js +197 -0
- package/dist/api/compiler/transformers/declarations.d.ts +175 -0
- package/dist/api/compiler/transformers/declarations.js +2380 -0
- package/dist/api/compiler/transformers/decorator-metadata.d.ts +54 -0
- package/dist/api/compiler/transformers/decorator-metadata.js +554 -0
- package/dist/api/compiler/transformers/decorator-utilities.d.ts +38 -0
- package/dist/api/compiler/transformers/decorator-utilities.js +238 -0
- package/dist/api/compiler/transformers/destructuring.d.ts +25 -0
- package/dist/api/compiler/transformers/destructuring.js +626 -0
- package/dist/api/compiler/transformers/downlevel.d.ts +6 -0
- package/dist/api/compiler/transformers/downlevel.js +45 -0
- package/dist/api/compiler/transformers/emit-resolver.d.ts +61 -0
- package/dist/api/compiler/transformers/emit-resolver.js +197 -0
- package/dist/api/compiler/transformers/es-decorators.d.ts +118 -0
- package/dist/api/compiler/transformers/es-decorators.js +1901 -0
- package/dist/api/compiler/transformers/exponentiation.d.ts +11 -0
- package/dist/api/compiler/transformers/exponentiation.js +76 -0
- package/dist/api/compiler/transformers/external-module-info.d.ts +35 -0
- package/dist/api/compiler/transformers/external-module-info.js +351 -0
- package/dist/api/compiler/transformers/for-await.d.ts +43 -0
- package/dist/api/compiler/transformers/for-await.js +469 -0
- package/dist/api/compiler/transformers/import-elision.d.ts +16 -0
- package/dist/api/compiler/transformers/import-elision.js +124 -0
- package/dist/api/compiler/transformers/jsx-entities.d.ts +1 -0
- package/dist/api/compiler/transformers/jsx-entities.js +256 -0
- package/dist/api/compiler/transformers/jsx.d.ts +71 -0
- package/dist/api/compiler/transformers/jsx.js +700 -0
- package/dist/api/compiler/transformers/legacy-decorators.d.ts +56 -0
- package/dist/api/compiler/transformers/legacy-decorators.js +564 -0
- package/dist/api/compiler/transformers/logical-assignment.d.ts +14 -0
- package/dist/api/compiler/transformers/logical-assignment.js +62 -0
- package/dist/api/compiler/transformers/module-utilities.d.ts +9 -0
- package/dist/api/compiler/transformers/module-utilities.js +36 -0
- package/dist/api/compiler/transformers/module.d.ts +49 -0
- package/dist/api/compiler/transformers/module.js +296 -0
- package/dist/api/compiler/transformers/named-evaluation.d.ts +26 -0
- package/dist/api/compiler/transformers/named-evaluation.js +266 -0
- package/dist/api/compiler/transformers/nullish-coalescing.d.ts +9 -0
- package/dist/api/compiler/transformers/nullish-coalescing.js +26 -0
- package/dist/api/compiler/transformers/object-rest-spread.d.ts +34 -0
- package/dist/api/compiler/transformers/object-rest-spread.js +411 -0
- package/dist/api/compiler/transformers/optional-catch.d.ts +9 -0
- package/dist/api/compiler/transformers/optional-catch.js +20 -0
- package/dist/api/compiler/transformers/optional-chain.d.ts +14 -0
- package/dist/api/compiler/transformers/optional-chain.js +188 -0
- package/dist/api/compiler/transformers/reference-resolver.d.ts +128 -0
- package/dist/api/compiler/transformers/reference-resolver.js +1155 -0
- package/dist/api/compiler/transformers/runtime-syntax.d.ts +71 -0
- package/dist/api/compiler/transformers/runtime-syntax.js +753 -0
- package/dist/api/compiler/transformers/subtree-facts.d.ts +9 -0
- package/dist/api/compiler/transformers/subtree-facts.js +203 -0
- package/dist/api/compiler/transformers/syntax-facts.d.ts +51 -0
- package/dist/api/compiler/transformers/syntax-facts.js +254 -0
- package/dist/api/compiler/transformers/tagged-template.d.ts +17 -0
- package/dist/api/compiler/transformers/tagged-template.js +148 -0
- package/dist/api/compiler/transformers/transformer.d.ts +17 -0
- package/dist/api/compiler/transformers/transformer.js +54 -0
- package/dist/api/compiler/transformers/type-eraser.d.ts +21 -0
- package/dist/api/compiler/transformers/type-eraser.js +346 -0
- package/dist/api/compiler/transformers/type-serialization.d.ts +20 -0
- package/dist/api/compiler/transformers/type-serialization.js +347 -0
- package/dist/api/compiler/transformers/using.d.ts +56 -0
- package/dist/api/compiler/transformers/using.js +453 -0
- package/dist/api/compiler/transformers/utilities.d.ts +50 -0
- package/dist/api/compiler/transformers/utilities.js +347 -0
- package/dist/api/compiler/transformers/visitor-base.d.ts +6 -0
- package/dist/api/compiler/transformers/visitor-base.js +817 -0
- package/dist/api/compiler/transformers/visitor-hooks.d.ts +29 -0
- package/dist/api/compiler/transformers/visitor-hooks.js +189 -0
- package/dist/api/compiler/tsconfig.d.ts +177 -0
- package/dist/api/compiler/tsconfig.js +1311 -0
- package/dist/api/compiler/type-printer.d.ts +15 -0
- package/dist/api/compiler/type-printer.js +74 -0
- package/dist/api/compiler/types.d.ts +87 -0
- package/dist/api/compiler/types.js +23 -0
- package/dist/api/compiler/unicode-identifiers.d.ts +2 -0
- package/dist/api/compiler/unicode-identifiers.js +209 -0
- package/dist/api/compiler/unicode-properties.d.ts +8 -0
- package/dist/api/compiler/unicode-properties.js +531 -0
- package/dist/api/compiler/vfs-match.d.ts +24 -0
- package/dist/api/compiler/vfs-match.js +587 -0
- package/dist/api/library/ast.d.ts +74 -0
- package/dist/api/library/ast.generated.d.ts +1145 -0
- package/dist/api/library/ast.generated.js +3 -0
- package/dist/api/library/ast.js +5 -0
- package/dist/api/library/checker.d.ts +51 -0
- package/dist/api/library/checker.js +318 -0
- package/dist/api/library/compiler-options.generated.d.ts +108 -0
- package/dist/api/library/compiler-options.generated.js +3 -0
- package/dist/api/library/diagnostics.d.ts +13 -0
- package/dist/api/library/diagnostics.js +50 -0
- package/dist/api/library/disk.d.ts +13 -0
- package/dist/api/library/disk.js +66 -0
- package/dist/api/library/enums.generated.d.ts +891 -0
- package/dist/api/library/enums.generated.js +916 -0
- package/dist/api/library/errors.d.ts +13 -0
- package/dist/api/library/errors.js +24 -0
- package/dist/api/library/host.d.ts +24 -0
- package/dist/api/library/host.js +52 -0
- package/dist/api/library/index.d.ts +14 -0
- package/dist/api/library/index.js +15 -0
- package/dist/api/library/nodes.d.ts +51 -0
- package/dist/api/library/nodes.js +196 -0
- package/dist/api/library/options.d.ts +144 -0
- package/dist/api/library/options.js +308 -0
- package/dist/api/library/parse.d.ts +19 -0
- package/dist/api/library/parse.js +41 -0
- package/dist/api/library/program.d.ts +21 -0
- package/dist/api/library/program.js +234 -0
- package/dist/api/library/symbols.d.ts +8 -0
- package/dist/api/library/symbols.js +11 -0
- package/dist/api/library/types.d.ts +313 -0
- package/dist/api/library/types.js +6 -0
- package/package.json +22 -8
- package/src/compiler/ast-utilities.ts +548 -0
- package/src/compiler/ast.ts +12862 -0
- package/src/compiler/astnav.ts +799 -0
- package/src/compiler/binder-utilities.ts +1392 -0
- package/src/compiler/binder.ts +2703 -0
- package/src/compiler/build-info.ts +1197 -0
- package/src/compiler/character-codes.ts +323 -0
- package/src/compiler/checker-calls.ts +2155 -0
- package/src/compiler/checker-classes.ts +706 -0
- package/src/compiler/checker-contextual.ts +1457 -0
- package/src/compiler/checker-declaration-order.ts +438 -0
- package/src/compiler/checker-declarations.ts +1194 -0
- package/src/compiler/checker-declared-types.ts +919 -0
- package/src/compiler/checker-decorators.ts +694 -0
- package/src/compiler/checker-deprecation.ts +359 -0
- package/src/compiler/checker-destructuring.ts +805 -0
- package/src/compiler/checker-elaboration.ts +477 -0
- package/src/compiler/checker-emit-helpers.ts +224 -0
- package/src/compiler/checker-emit-resolver.ts +769 -0
- package/src/compiler/checker-evaluator.ts +243 -0
- package/src/compiler/checker-expressions.ts +1831 -0
- package/src/compiler/checker-features.ts +361 -0
- package/src/compiler/checker-flow.ts +394 -0
- package/src/compiler/checker-functions.ts +1296 -0
- package/src/compiler/checker-generated-code.ts +227 -0
- package/src/compiler/checker-globals.ts +52 -0
- package/src/compiler/checker-grammar.ts +3584 -0
- package/src/compiler/checker-heritage.ts +1233 -0
- package/src/compiler/checker-inference.ts +2576 -0
- package/src/compiler/checker-iteration.ts +1206 -0
- package/src/compiler/checker-javascript.ts +502 -0
- package/src/compiler/checker-jsdoc.ts +360 -0
- package/src/compiler/checker-jsx.ts +1924 -0
- package/src/compiler/checker-literals.ts +61 -0
- package/src/compiler/checker-members.ts +2436 -0
- package/src/compiler/checker-modules.ts +2886 -0
- package/src/compiler/checker-narrowing.ts +3230 -0
- package/src/compiler/checker-object-literals.ts +575 -0
- package/src/compiler/checker-operators.ts +1422 -0
- package/src/compiler/checker-overloads.ts +328 -0
- package/src/compiler/checker-property-access.ts +906 -0
- package/src/compiler/checker-services.ts +1149 -0
- package/src/compiler/checker-signatures.ts +1032 -0
- package/src/compiler/checker-source-file.ts +732 -0
- package/src/compiler/checker-statements.ts +292 -0
- package/src/compiler/checker-super.ts +261 -0
- package/src/compiler/checker-symbol-types.ts +2107 -0
- package/src/compiler/checker-symbols.ts +2150 -0
- package/src/compiler/checker-type-factory.ts +2579 -0
- package/src/compiler/checker-type-nodes.ts +1033 -0
- package/src/compiler/checker-type-operators.ts +2502 -0
- package/src/compiler/checker-types.ts +2340 -0
- package/src/compiler/checker-unused.ts +642 -0
- package/src/compiler/checker-utilities.ts +161 -0
- package/src/compiler/checker.ts +1116 -0
- package/src/compiler/command-line.ts +436 -0
- package/src/compiler/compile-program.ts +439 -0
- package/src/compiler/decoder.ts +1209 -0
- package/src/compiler/diagnostic-locales.ts +86 -0
- package/src/compiler/diagnostic-messages.ts +2349 -0
- package/src/compiler/diagnostics.ts +897 -0
- package/src/compiler/emitter.ts +434 -0
- package/src/compiler/encoder.ts +1945 -0
- package/src/compiler/file-include.ts +673 -0
- package/src/compiler/file-loader.ts +1528 -0
- package/src/compiler/file-system.ts +143 -0
- package/src/compiler/flow.ts +89 -0
- package/src/compiler/help.ts +473 -0
- package/src/compiler/incremental.ts +2784 -0
- package/src/compiler/init.ts +141 -0
- package/src/compiler/instantiation.ts +894 -0
- package/src/compiler/jsdoc.ts +1386 -0
- package/src/compiler/link-tables.ts +98 -0
- package/src/compiler/locale-data.ts +203 -0
- package/src/compiler/locale.ts +307 -0
- package/src/compiler/locales/cs-CZ.ts +5 -0
- package/src/compiler/locales/de-DE.ts +5 -0
- package/src/compiler/locales/es-ES.ts +5 -0
- package/src/compiler/locales/fr-FR.ts +5 -0
- package/src/compiler/locales/it-IT.ts +5 -0
- package/src/compiler/locales/ja-JP.ts +5 -0
- package/src/compiler/locales/ko-KR.ts +5 -0
- package/src/compiler/locales/pl-PL.ts +5 -0
- package/src/compiler/locales/pt-BR.ts +5 -0
- package/src/compiler/locales/ru-RU.ts +5 -0
- package/src/compiler/locales/tr-TR.ts +5 -0
- package/src/compiler/locales/zh-CN.ts +5 -0
- package/src/compiler/locales/zh-TW.ts +5 -0
- package/src/compiler/module-resolution-types.ts +243 -0
- package/src/compiler/module-resolution.ts +2072 -0
- package/src/compiler/module-specifiers.ts +1491 -0
- package/src/compiler/name-resolver.ts +646 -0
- package/src/compiler/node-builder-names.ts +1069 -0
- package/src/compiler/node-builder-pseudo.ts +892 -0
- package/src/compiler/node-builder-reuse.ts +764 -0
- package/src/compiler/node-builder.ts +3425 -0
- package/src/compiler/option-declarations.ts +1560 -0
- package/src/compiler/options.ts +1576 -0
- package/src/compiler/output-paths.ts +334 -0
- package/src/compiler/package-json.ts +1083 -0
- package/src/compiler/parallel-check.ts +1951 -0
- package/src/compiler/parallel-parse.ts +590 -0
- package/src/compiler/parse-thread.ts +140 -0
- package/src/compiler/parser.ts +7716 -0
- package/src/compiler/path.ts +717 -0
- package/src/compiler/printer/async-helpers.ts +183 -0
- package/src/compiler/printer/auto-generate.ts +27 -0
- package/src/compiler/printer/decorator-helpers.ts +218 -0
- package/src/compiler/printer/emit-context.ts +679 -0
- package/src/compiler/printer/emit-flags.ts +64 -0
- package/src/compiler/printer/factory-base.ts +2577 -0
- package/src/compiler/printer/factory.ts +764 -0
- package/src/compiler/printer/helpers.ts +291 -0
- package/src/compiler/printer/name-generator.ts +372 -0
- package/src/compiler/printer/printer.ts +5072 -0
- package/src/compiler/printer/text-writer.ts +183 -0
- package/src/compiler/printer/utilities.ts +884 -0
- package/src/compiler/program-checker.ts +592 -0
- package/src/compiler/program-utilities.ts +435 -0
- package/src/compiler/program.ts +1419 -0
- package/src/compiler/pseudo-bigint.ts +62 -0
- package/src/compiler/regexp-checker.ts +1142 -0
- package/src/compiler/relations.ts +5149 -0
- package/src/compiler/reparser.ts +1566 -0
- package/src/compiler/scanner.ts +2951 -0
- package/src/compiler/show-config.ts +239 -0
- package/src/compiler/side-state.ts +125 -0
- package/src/compiler/sourcemap.ts +366 -0
- package/src/compiler/spelling.ts +122 -0
- package/src/compiler/symbol-accessibility.ts +1071 -0
- package/src/compiler/symbol.ts +439 -0
- package/src/compiler/symlinks.ts +137 -0
- package/src/compiler/syntax-kind.ts +391 -0
- package/src/compiler/thread-entry.ts +191 -0
- package/src/compiler/timeline.ts +53 -0
- package/src/compiler/transformers/alias-references.ts +757 -0
- package/src/compiler/transformers/async-utilities.ts +335 -0
- package/src/compiler/transformers/async.ts +838 -0
- package/src/compiler/transformers/class-fields.ts +2967 -0
- package/src/compiler/transformers/class-utilities.ts +324 -0
- package/src/compiler/transformers/commonjs-module.ts +1621 -0
- package/src/compiler/transformers/const-enum-inliner.ts +50 -0
- package/src/compiler/transformers/declarations-diagnostics.ts +832 -0
- package/src/compiler/transformers/declarations-pseudo.ts +966 -0
- package/src/compiler/transformers/declarations-resolver.ts +249 -0
- package/src/compiler/transformers/declarations-syntactic.ts +1859 -0
- package/src/compiler/transformers/declarations-tracker.ts +269 -0
- package/src/compiler/transformers/declarations.ts +3120 -0
- package/src/compiler/transformers/decorator-metadata.ts +697 -0
- package/src/compiler/transformers/decorator-utilities.ts +283 -0
- package/src/compiler/transformers/destructuring.ts +708 -0
- package/src/compiler/transformers/downlevel.ts +50 -0
- package/src/compiler/transformers/emit-resolver.ts +258 -0
- package/src/compiler/transformers/es-decorators.ts +2682 -0
- package/src/compiler/transformers/exponentiation.ts +80 -0
- package/src/compiler/transformers/external-module-info.ts +412 -0
- package/src/compiler/transformers/for-await.ts +687 -0
- package/src/compiler/transformers/import-elision.ts +152 -0
- package/src/compiler/transformers/jsx-entities.ts +256 -0
- package/src/compiler/transformers/jsx.ts +824 -0
- package/src/compiler/transformers/legacy-decorators.ts +726 -0
- package/src/compiler/transformers/logical-assignment.ts +75 -0
- package/src/compiler/transformers/module-utilities.ts +42 -0
- package/src/compiler/transformers/module.ts +474 -0
- package/src/compiler/transformers/named-evaluation.ts +389 -0
- package/src/compiler/transformers/nullish-coalescing.ts +35 -0
- package/src/compiler/transformers/object-rest-spread.ts +577 -0
- package/src/compiler/transformers/optional-catch.ts +29 -0
- package/src/compiler/transformers/optional-chain.ts +246 -0
- package/src/compiler/transformers/reference-resolver.ts +1201 -0
- package/src/compiler/transformers/runtime-syntax.ts +942 -0
- package/src/compiler/transformers/subtree-facts.ts +245 -0
- package/src/compiler/transformers/syntax-facts.ts +353 -0
- package/src/compiler/transformers/tagged-template.ts +167 -0
- package/src/compiler/transformers/transformer.ts +56 -0
- package/src/compiler/transformers/type-eraser.ts +520 -0
- package/src/compiler/transformers/type-serialization.ts +374 -0
- package/src/compiler/transformers/using.ts +613 -0
- package/src/compiler/transformers/utilities.ts +419 -0
- package/src/compiler/transformers/visitor-base.ts +1601 -0
- package/src/compiler/transformers/visitor-hooks.ts +252 -0
- package/src/compiler/tsc-build.ts +1418 -0
- package/src/compiler/tsc-cli.ts +666 -0
- package/src/compiler/tsc-compile.ts +437 -0
- package/src/compiler/tsc-watch.ts +854 -0
- package/src/compiler/tsconfig.ts +1574 -0
- package/src/compiler/type-printer.ts +110 -0
- package/src/compiler/types.ts +115 -0
- package/src/compiler/unicode-identifiers.ts +212 -0
- package/src/compiler/unicode-properties.ts +537 -0
- package/src/compiler/vfs-match.ts +597 -0
- package/src/compiler/xxh3.ts +650 -0
- package/src/library/ast.generated.ts +1685 -0
- package/src/library/ast.ts +104 -0
- package/src/library/checker.ts +384 -0
- package/src/library/compiler-options.generated.ts +114 -0
- package/src/library/diagnostics.ts +72 -0
- package/src/library/disk.ts +73 -0
- package/src/library/enums.generated.ts +1024 -0
- package/src/library/errors.ts +26 -0
- package/src/library/host.ts +63 -0
- package/src/library/index.ts +71 -0
- package/src/library/nodes.ts +232 -0
- package/src/library/options.ts +449 -0
- package/src/library/parse.ts +63 -0
- package/src/library/program.ts +293 -0
- package/src/library/symbols.ts +15 -0
- package/src/library/types.ts +359 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type Node } from '../ast.js';
|
|
2
|
+
import type { CompilerOptions } from '../options.js';
|
|
3
|
+
import type { EmitContext } from '../printer/emit-context.js';
|
|
4
|
+
import type { EmitResolver } from './emit-resolver.js';
|
|
5
|
+
import { Transformer } from './transformer.js';
|
|
6
|
+
export declare class ConstEnumInliner extends Transformer {
|
|
7
|
+
readonly options: CompilerOptions;
|
|
8
|
+
readonly resolver: EmitResolver;
|
|
9
|
+
constructor(context: EmitContext, options: CompilerOptions, resolver: EmitResolver);
|
|
10
|
+
visit(node: Node): Node | undefined;
|
|
11
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { getTextOfNodeFromSourceText } from '../ast-utilities.js';
|
|
2
|
+
import { getSourceFileOfNode } from '../binder-utilities.js';
|
|
3
|
+
import { constantExpression } from './runtime-syntax.js';
|
|
4
|
+
import { Transformer } from './transformer.js';
|
|
5
|
+
export class ConstEnumInliner extends Transformer {
|
|
6
|
+
options;
|
|
7
|
+
resolver;
|
|
8
|
+
constructor(context, options, resolver) {
|
|
9
|
+
super(context);
|
|
10
|
+
this.options = options;
|
|
11
|
+
this.resolver = resolver;
|
|
12
|
+
}
|
|
13
|
+
visit(node) {
|
|
14
|
+
if (node.kind !== 212 /* SyntaxKind.PropertyAccessExpression */ && node.kind !== 213 /* SyntaxKind.ElementAccessExpression */)
|
|
15
|
+
return this.visitEachChild(node);
|
|
16
|
+
const parseNode = this.context.parseNode(node);
|
|
17
|
+
if (parseNode === undefined)
|
|
18
|
+
return this.visitEachChild(node);
|
|
19
|
+
const value = this.resolver.getConstantValue(parseNode);
|
|
20
|
+
if (value.kind === 0 /* ConstantKind.None */)
|
|
21
|
+
return this.visitEachChild(node);
|
|
22
|
+
const replacement = constantExpression(this.factory, value);
|
|
23
|
+
if (this.options.removeComments !== true) {
|
|
24
|
+
const original = this.context.mostOriginal(node);
|
|
25
|
+
if ((original.flags & 16 /* NodeFlags.Synthesized */) === 0) {
|
|
26
|
+
const text = getTextOfNodeFromSourceText(getSourceFileOfNode(original).text, original);
|
|
27
|
+
this.context.addSyntheticTrailingComment(replacement, 3 /* SyntaxKind.MultiLineCommentTrivia */, safeMultiLineComment(text), false);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return replacement;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/** ` text ` with each `*` + `/` broken up so it can't end the comment. */
|
|
34
|
+
function safeMultiLineComment(text) {
|
|
35
|
+
return ' ' + text.split('*/').join('*_/') + ' ';
|
|
36
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { type Node } from '../ast.js';
|
|
2
|
+
import { Diagnostic, type DiagnosticMessage } from '../diagnostics.js';
|
|
3
|
+
import { type SymbolAccessibilityResult } from './declarations-resolver.js';
|
|
4
|
+
export declare function createDiagnosticForNode(node: Node, message: DiagnosticMessage, args: readonly string[]): Diagnostic;
|
|
5
|
+
/** The text of a node for messages. */
|
|
6
|
+
export declare function textOfNode(node: Node): string;
|
|
7
|
+
export declare function nameToString(name: Node | undefined): string;
|
|
8
|
+
export declare const enum DiagnosticContextKind {
|
|
9
|
+
/** No declaration is being written; reporting is a bug. */
|
|
10
|
+
None = 0,
|
|
11
|
+
/** The type of a declaration. */
|
|
12
|
+
Declaration = 1,
|
|
13
|
+
/** The computed name of a declaration. */
|
|
14
|
+
DeclarationName = 2,
|
|
15
|
+
/** The expression of `export default`. */
|
|
16
|
+
DefaultExport = 3,
|
|
17
|
+
/** A class's `extends` expression, written as a separate `_base` variable. */
|
|
18
|
+
ExtendsExpression = 4
|
|
19
|
+
}
|
|
20
|
+
/** Which message an inaccessible name in the declaration being written reports. */
|
|
21
|
+
export declare class DiagnosticContext {
|
|
22
|
+
readonly kind: DiagnosticContextKind;
|
|
23
|
+
readonly node: Node | undefined;
|
|
24
|
+
/** The class name for `ExtendsExpression`. */
|
|
25
|
+
readonly typeName: Node | undefined;
|
|
26
|
+
constructor(kind: DiagnosticContextKind, node: Node | undefined, typeName: Node | undefined);
|
|
27
|
+
}
|
|
28
|
+
export declare const noDiagnosticContext: DiagnosticContext;
|
|
29
|
+
export declare function declarationContext(node: Node): DiagnosticContext;
|
|
30
|
+
export declare function declarationNameContext(node: Node): DiagnosticContext;
|
|
31
|
+
export declare class SymbolAccessibilityDiagnostic {
|
|
32
|
+
readonly errorNode: Node;
|
|
33
|
+
readonly message: DiagnosticMessage;
|
|
34
|
+
/** The declaration name passed as the first message argument, if any. */
|
|
35
|
+
readonly typeName: Node | undefined;
|
|
36
|
+
constructor(errorNode: Node, message: DiagnosticMessage, typeName: Node | undefined);
|
|
37
|
+
}
|
|
38
|
+
/** Whether a declaration of this kind can report inaccessible names in its type. */
|
|
39
|
+
export declare function canProduceDiagnostics(node: Node): boolean;
|
|
40
|
+
/** The diagnostic for an inaccessible name, or undefined if this kind of context reports none. */
|
|
41
|
+
export declare function getSymbolAccessibilityDiagnostic(context: DiagnosticContext, result: SymbolAccessibilityResult): SymbolAccessibilityDiagnostic | undefined;
|
|
42
|
+
/** The isolatedDeclarations error for a type that needs inference at `node`. */
|
|
43
|
+
export declare function createIsolatedDeclarationError(node: Node, requiresAddingUndefined: boolean): Diagnostic;
|
|
44
|
+
export declare class AllAccessorDeclarations {
|
|
45
|
+
readonly firstAccessor: Node;
|
|
46
|
+
readonly secondAccessor: Node | undefined;
|
|
47
|
+
readonly getAccessor: Node | undefined;
|
|
48
|
+
readonly setAccessor: Node | undefined;
|
|
49
|
+
constructor(firstAccessor: Node, secondAccessor: Node | undefined, getAccessor: Node | undefined, setAccessor: Node | undefined);
|
|
50
|
+
}
|
|
51
|
+
/** The get and set accessors declaring the same property as `accessor`. */
|
|
52
|
+
export declare function getAllAccessorDeclarations(accessor: Node): AllAccessorDeclarations;
|
|
@@ -0,0 +1,538 @@
|
|
|
1
|
+
// Declaration emit errors: names that can't be written in a declaration file, and types that
|
|
2
|
+
// `isolatedDeclarations` can't write without inference.
|
|
3
|
+
import { CallExpression, HeritageClause, ParameterDeclaration, SetAccessorDeclaration, getInitializer, getName, getParameters, getSymbol, getType, } from '../ast.js';
|
|
4
|
+
import { declarationNameToString, getErrorRangeForNode, getNameOfDeclaration, getSourceFileOfNode, getSourceTextOfNode, hasSyntacticModifier, isEntityNameExpression, isStatic, isTypeNodeKind, } from '../binder-utilities.js';
|
|
5
|
+
import { isFunctionLikeDeclarationKind } from '../ast-utilities.js';
|
|
6
|
+
import { Diagnostic } from '../diagnostics.js';
|
|
7
|
+
import { isStatement } from '../printer/utilities.js';
|
|
8
|
+
import { isParameterPropertyDeclaration } from './utilities.js';
|
|
9
|
+
export function createDiagnosticForNode(node, message, args) {
|
|
10
|
+
const file = getSourceFileOfNode(node);
|
|
11
|
+
const range = getErrorRangeForNode(file, node);
|
|
12
|
+
return new Diagnostic(file.diagnosticFile(), range.pos, range.end, message, args);
|
|
13
|
+
}
|
|
14
|
+
/** The text of a node for messages. */
|
|
15
|
+
export function textOfNode(node) {
|
|
16
|
+
return getSourceTextOfNode(getSourceFileOfNode(node), node);
|
|
17
|
+
}
|
|
18
|
+
export function nameToString(name) {
|
|
19
|
+
return name === undefined ? '(Missing)' : declarationNameToString(getSourceFileOfNode(name), name);
|
|
20
|
+
}
|
|
21
|
+
/** Which message an inaccessible name in the declaration being written reports. */
|
|
22
|
+
export class DiagnosticContext {
|
|
23
|
+
kind;
|
|
24
|
+
node;
|
|
25
|
+
/** The class name for `ExtendsExpression`. */
|
|
26
|
+
typeName;
|
|
27
|
+
constructor(kind, node, typeName) {
|
|
28
|
+
this.kind = kind;
|
|
29
|
+
this.node = node;
|
|
30
|
+
this.typeName = typeName;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
export const noDiagnosticContext = new DiagnosticContext(0 /* DiagnosticContextKind.None */, undefined, undefined);
|
|
34
|
+
export function declarationContext(node) {
|
|
35
|
+
return new DiagnosticContext(1 /* DiagnosticContextKind.Declaration */, node, undefined);
|
|
36
|
+
}
|
|
37
|
+
export function declarationNameContext(node) {
|
|
38
|
+
return new DiagnosticContext(2 /* DiagnosticContextKind.DeclarationName */, node, undefined);
|
|
39
|
+
}
|
|
40
|
+
export class SymbolAccessibilityDiagnostic {
|
|
41
|
+
errorNode;
|
|
42
|
+
message;
|
|
43
|
+
/** The declaration name passed as the first message argument, if any. */
|
|
44
|
+
typeName;
|
|
45
|
+
constructor(errorNode, message, typeName) {
|
|
46
|
+
this.errorNode = errorNode;
|
|
47
|
+
this.message = message;
|
|
48
|
+
this.typeName = typeName;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
/** Whether a declaration of this kind can report inaccessible names in its type. */
|
|
52
|
+
export function canProduceDiagnostics(node) {
|
|
53
|
+
switch (node.kind) {
|
|
54
|
+
case 261 /* SyntaxKind.VariableDeclaration */:
|
|
55
|
+
case 173 /* SyntaxKind.PropertyDeclaration */:
|
|
56
|
+
case 172 /* SyntaxKind.PropertySignature */:
|
|
57
|
+
case 209 /* SyntaxKind.BindingElement */:
|
|
58
|
+
case 179 /* SyntaxKind.SetAccessor */:
|
|
59
|
+
case 178 /* SyntaxKind.GetAccessor */:
|
|
60
|
+
case 181 /* SyntaxKind.ConstructSignature */:
|
|
61
|
+
case 180 /* SyntaxKind.CallSignature */:
|
|
62
|
+
case 175 /* SyntaxKind.MethodDeclaration */:
|
|
63
|
+
case 174 /* SyntaxKind.MethodSignature */:
|
|
64
|
+
case 263 /* SyntaxKind.FunctionDeclaration */:
|
|
65
|
+
case 170 /* SyntaxKind.Parameter */:
|
|
66
|
+
case 169 /* SyntaxKind.TypeParameter */:
|
|
67
|
+
case 234 /* SyntaxKind.ExpressionWithTypeArguments */:
|
|
68
|
+
case 272 /* SyntaxKind.ImportEqualsDeclaration */:
|
|
69
|
+
case 266 /* SyntaxKind.TypeAliasDeclaration */:
|
|
70
|
+
case 345 /* SyntaxKind.JSTypeAliasDeclaration */:
|
|
71
|
+
case 177 /* SyntaxKind.Constructor */:
|
|
72
|
+
case 182 /* SyntaxKind.IndexSignature */:
|
|
73
|
+
case 212 /* SyntaxKind.PropertyAccessExpression */:
|
|
74
|
+
case 213 /* SyntaxKind.ElementAccessExpression */:
|
|
75
|
+
case 227 /* SyntaxKind.BinaryExpression */:
|
|
76
|
+
case 214 /* SyntaxKind.CallExpression */:
|
|
77
|
+
return true;
|
|
78
|
+
}
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
/** The diagnostic for an inaccessible name, or undefined if this kind of context reports none. */
|
|
82
|
+
export function getSymbolAccessibilityDiagnostic(context, result) {
|
|
83
|
+
const node = context.node;
|
|
84
|
+
switch (context.kind) {
|
|
85
|
+
case 0 /* DiagnosticContextKind.None */:
|
|
86
|
+
throw new Error('Diagnostic emitted without context');
|
|
87
|
+
case 3 /* DiagnosticContextKind.DefaultExport */:
|
|
88
|
+
return new SymbolAccessibilityDiagnostic(node, 1074 /* Diagnostics.Default_export_of_the_module_has_or_is_using_private_name_0 */, undefined);
|
|
89
|
+
case 4 /* DiagnosticContextKind.ExtendsExpression */:
|
|
90
|
+
return new SymbolAccessibilityDiagnostic(node, 1014 /* Diagnostics.X_extends_clause_of_exported_class_0_has_or_is_using_private_name_1 */, context.typeName);
|
|
91
|
+
case 2 /* DiagnosticContextKind.DeclarationName */:
|
|
92
|
+
if (node.kind === 178 /* SyntaxKind.GetAccessor */ || node.kind === 179 /* SyntaxKind.SetAccessor */)
|
|
93
|
+
return simple(node, accessorNameMessage(node, result));
|
|
94
|
+
if (node.kind === 175 /* SyntaxKind.MethodDeclaration */ || node.kind === 174 /* SyntaxKind.MethodSignature */)
|
|
95
|
+
return simple(node, methodNameMessage(node, result));
|
|
96
|
+
return forDeclaration(node, result);
|
|
97
|
+
case 1 /* DiagnosticContextKind.Declaration */:
|
|
98
|
+
return forDeclaration(node, result);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
function simple(node, message) {
|
|
102
|
+
return message === undefined
|
|
103
|
+
? undefined
|
|
104
|
+
: new SymbolAccessibilityDiagnostic(node, message, getNameOfDeclaration(node));
|
|
105
|
+
}
|
|
106
|
+
function forDeclaration(node, result) {
|
|
107
|
+
switch (node.kind) {
|
|
108
|
+
case 261 /* SyntaxKind.VariableDeclaration */:
|
|
109
|
+
case 173 /* SyntaxKind.PropertyDeclaration */:
|
|
110
|
+
case 172 /* SyntaxKind.PropertySignature */:
|
|
111
|
+
case 212 /* SyntaxKind.PropertyAccessExpression */:
|
|
112
|
+
case 213 /* SyntaxKind.ElementAccessExpression */:
|
|
113
|
+
case 227 /* SyntaxKind.BinaryExpression */:
|
|
114
|
+
case 209 /* SyntaxKind.BindingElement */:
|
|
115
|
+
case 177 /* SyntaxKind.Constructor */:
|
|
116
|
+
return simple(node, variableTypeMessage(node, result));
|
|
117
|
+
case 179 /* SyntaxKind.SetAccessor */:
|
|
118
|
+
case 178 /* SyntaxKind.GetAccessor */: {
|
|
119
|
+
const name = getNameOfDeclaration(node);
|
|
120
|
+
const message = accessorTypeMessage(node, result);
|
|
121
|
+
return name === undefined ? undefined : new SymbolAccessibilityDiagnostic(name, message, name);
|
|
122
|
+
}
|
|
123
|
+
case 181 /* SyntaxKind.ConstructSignature */:
|
|
124
|
+
case 180 /* SyntaxKind.CallSignature */:
|
|
125
|
+
case 175 /* SyntaxKind.MethodDeclaration */:
|
|
126
|
+
case 174 /* SyntaxKind.MethodSignature */:
|
|
127
|
+
case 263 /* SyntaxKind.FunctionDeclaration */:
|
|
128
|
+
case 182 /* SyntaxKind.IndexSignature */: {
|
|
129
|
+
const name = getNameOfDeclaration(node);
|
|
130
|
+
return new SymbolAccessibilityDiagnostic(name ?? node, returnTypeMessage(node, result), undefined);
|
|
131
|
+
}
|
|
132
|
+
case 170 /* SyntaxKind.Parameter */:
|
|
133
|
+
if (isParameterPropertyDeclaration(node, node.parent) &&
|
|
134
|
+
hasSyntacticModifier(node.parent, 2 /* ModifierFlags.Private */))
|
|
135
|
+
return simple(node, variableTypeMessage(node, result));
|
|
136
|
+
return simple(node, parameterTypeMessage(node, result));
|
|
137
|
+
case 169 /* SyntaxKind.TypeParameter */:
|
|
138
|
+
return simple(node, typeParameterConstraintMessage(node));
|
|
139
|
+
case 234 /* SyntaxKind.ExpressionWithTypeArguments */:
|
|
140
|
+
return heritageDiagnostic(node);
|
|
141
|
+
case 272 /* SyntaxKind.ImportEqualsDeclaration */:
|
|
142
|
+
return simple(node, 1004 /* Diagnostics.Import_declaration_0_is_using_private_name_1 */);
|
|
143
|
+
case 266 /* SyntaxKind.TypeAliasDeclaration */:
|
|
144
|
+
case 345 /* SyntaxKind.JSTypeAliasDeclaration */: {
|
|
145
|
+
const message = result.errorModuleName !== ''
|
|
146
|
+
? 1076 /* Diagnostics.Exported_type_alias_0_has_or_is_using_private_name_1_from_module_2 */
|
|
147
|
+
: 1073 /* Diagnostics.Exported_type_alias_0_has_or_is_using_private_name_1 */;
|
|
148
|
+
const type = getType(node);
|
|
149
|
+
return new SymbolAccessibilityDiagnostic(type ?? node, message, getName(node));
|
|
150
|
+
}
|
|
151
|
+
case 214 /* SyntaxKind.CallExpression */: {
|
|
152
|
+
// `Object.defineProperty(exports, "name", …)` in JavaScript.
|
|
153
|
+
const name = node instanceof CallExpression ? node.arguments.nodes[1] : node;
|
|
154
|
+
return new SymbolAccessibilityDiagnostic(name, byModuleName(result, 1017 /* Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named */, 1018 /* Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 */, 1019 /* Diagnostics.Exported_variable_0_has_or_is_using_private_name_1 */), name);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
throw new Error('Attempted to set a declaration diagnostic context for unhandled node kind');
|
|
158
|
+
}
|
|
159
|
+
function heritageDiagnostic(node) {
|
|
160
|
+
const clause = node.parent;
|
|
161
|
+
const declaration = clause.parent;
|
|
162
|
+
let message;
|
|
163
|
+
if (declaration.kind === 264 /* SyntaxKind.ClassDeclaration */) {
|
|
164
|
+
if (clause instanceof HeritageClause && clause.token === 118 /* SyntaxKind.ImplementsKeyword */)
|
|
165
|
+
message = 1013 /* Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 */;
|
|
166
|
+
else if (getName(declaration) !== undefined)
|
|
167
|
+
message = 1014 /* Diagnostics.X_extends_clause_of_exported_class_0_has_or_is_using_private_name_1 */;
|
|
168
|
+
else
|
|
169
|
+
message = 1015 /* Diagnostics.X_extends_clause_of_exported_class_has_or_is_using_private_name_0 */;
|
|
170
|
+
}
|
|
171
|
+
else
|
|
172
|
+
message = 1016 /* Diagnostics.X_extends_clause_of_exported_interface_0_has_or_is_using_private_name_1 */;
|
|
173
|
+
return new SymbolAccessibilityDiagnostic(node, message, getNameOfDeclaration(declaration));
|
|
174
|
+
}
|
|
175
|
+
function byModuleName(result, cannotBeNamed, privateModule, nonModule) {
|
|
176
|
+
if (result.errorModuleName === '')
|
|
177
|
+
return nonModule;
|
|
178
|
+
return result.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? cannotBeNamed : privateModule;
|
|
179
|
+
}
|
|
180
|
+
function byModuleNameOnly(result, privateModule, nonModule) {
|
|
181
|
+
return result.errorModuleName !== '' ? privateModule : nonModule;
|
|
182
|
+
}
|
|
183
|
+
function accessorNameMessage(node, result) {
|
|
184
|
+
if (isStatic(node))
|
|
185
|
+
return byModuleName(result, 1020 /* Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named */, 1021 /* Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 */, 1022 /* Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1 */);
|
|
186
|
+
if (node.parent.kind === 264 /* SyntaxKind.ClassDeclaration */)
|
|
187
|
+
return byModuleName(result, 1023 /* Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named */, 1024 /* Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 */, 1025 /* Diagnostics.Public_property_0_of_exported_class_has_or_is_using_private_name_1 */);
|
|
188
|
+
return byModuleNameOnly(result, 1026 /* Diagnostics.Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2 */, 1027 /* Diagnostics.Property_0_of_exported_interface_has_or_is_using_private_name_1 */);
|
|
189
|
+
}
|
|
190
|
+
function methodNameMessage(node, result) {
|
|
191
|
+
if (isStatic(node))
|
|
192
|
+
return byModuleName(result, 1081 /* Diagnostics.Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named */, 1082 /* Diagnostics.Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 */, 1083 /* Diagnostics.Public_static_method_0_of_exported_class_has_or_is_using_private_name_1 */);
|
|
193
|
+
if (node.parent.kind === 264 /* SyntaxKind.ClassDeclaration */)
|
|
194
|
+
return byModuleName(result, 1084 /* Diagnostics.Public_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named */, 1085 /* Diagnostics.Public_method_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 */, 1086 /* Diagnostics.Public_method_0_of_exported_class_has_or_is_using_private_name_1 */);
|
|
195
|
+
return byModuleNameOnly(result, 1087 /* Diagnostics.Method_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2 */, 1088 /* Diagnostics.Method_0_of_exported_interface_has_or_is_using_private_name_1 */);
|
|
196
|
+
}
|
|
197
|
+
function variableTypeMessage(node, result) {
|
|
198
|
+
if (node.kind === 261 /* SyntaxKind.VariableDeclaration */ || node.kind === 209 /* SyntaxKind.BindingElement */)
|
|
199
|
+
return byModuleName(result, 1017 /* Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named */, 1018 /* Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 */, 1019 /* Diagnostics.Exported_variable_0_has_or_is_using_private_name_1 */);
|
|
200
|
+
// Constructor parameter properties report as parameters, unless the constructor is private.
|
|
201
|
+
if (node.kind === 173 /* SyntaxKind.PropertyDeclaration */ ||
|
|
202
|
+
node.kind === 212 /* SyntaxKind.PropertyAccessExpression */ ||
|
|
203
|
+
node.kind === 213 /* SyntaxKind.ElementAccessExpression */ ||
|
|
204
|
+
node.kind === 227 /* SyntaxKind.BinaryExpression */ ||
|
|
205
|
+
node.kind === 172 /* SyntaxKind.PropertySignature */ ||
|
|
206
|
+
(node.kind === 170 /* SyntaxKind.Parameter */ && hasSyntacticModifier(node.parent, 2 /* ModifierFlags.Private */))) {
|
|
207
|
+
if (isStatic(node))
|
|
208
|
+
return byModuleName(result, 1020 /* Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named */, 1021 /* Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 */, 1022 /* Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1 */);
|
|
209
|
+
if (node.parent.kind === 264 /* SyntaxKind.ClassDeclaration */ || node.kind === 170 /* SyntaxKind.Parameter */)
|
|
210
|
+
return byModuleName(result, 1023 /* Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named */, 1024 /* Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 */, 1025 /* Diagnostics.Public_property_0_of_exported_class_has_or_is_using_private_name_1 */);
|
|
211
|
+
return byModuleNameOnly(result, 1026 /* Diagnostics.Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2 */, 1027 /* Diagnostics.Property_0_of_exported_interface_has_or_is_using_private_name_1 */);
|
|
212
|
+
}
|
|
213
|
+
return undefined;
|
|
214
|
+
}
|
|
215
|
+
function accessorTypeMessage(node, result) {
|
|
216
|
+
if (node.kind === 179 /* SyntaxKind.SetAccessor */) {
|
|
217
|
+
// A setter's parameter type is written by the user, so it can always be named.
|
|
218
|
+
if (isStatic(node))
|
|
219
|
+
return byModuleNameOnly(result, 1028 /* Diagnostics.Parameter_type_of_public_static_setter_0_from_exported_class_has_or_is_using_name_1_from_private_module_2 */, 1029 /* Diagnostics.Parameter_type_of_public_static_setter_0_from_exported_class_has_or_is_using_private_name_1 */);
|
|
220
|
+
return byModuleNameOnly(result, 1030 /* Diagnostics.Parameter_type_of_public_setter_0_from_exported_class_has_or_is_using_name_1_from_private_module_2 */, 1031 /* Diagnostics.Parameter_type_of_public_setter_0_from_exported_class_has_or_is_using_private_name_1 */);
|
|
221
|
+
}
|
|
222
|
+
if (isStatic(node))
|
|
223
|
+
return byModuleName(result, 1032 /* Diagnostics.Return_type_of_public_static_getter_0_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named */, 1033 /* Diagnostics.Return_type_of_public_static_getter_0_from_exported_class_has_or_is_using_name_1_from_private_module_2 */, 1034 /* Diagnostics.Return_type_of_public_static_getter_0_from_exported_class_has_or_is_using_private_name_1 */);
|
|
224
|
+
return byModuleName(result, 1035 /* Diagnostics.Return_type_of_public_getter_0_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named */, 1036 /* Diagnostics.Return_type_of_public_getter_0_from_exported_class_has_or_is_using_name_1_from_private_module_2 */, 1037 /* Diagnostics.Return_type_of_public_getter_0_from_exported_class_has_or_is_using_private_name_1 */);
|
|
225
|
+
}
|
|
226
|
+
function returnTypeMessage(node, result) {
|
|
227
|
+
switch (node.kind) {
|
|
228
|
+
case 181 /* SyntaxKind.ConstructSignature */:
|
|
229
|
+
return byModuleNameOnly(result, 1038 /* Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 */, 1039 /* Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0 */);
|
|
230
|
+
case 180 /* SyntaxKind.CallSignature */:
|
|
231
|
+
return byModuleNameOnly(result, 1040 /* Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 */, 1041 /* Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0 */);
|
|
232
|
+
case 182 /* SyntaxKind.IndexSignature */:
|
|
233
|
+
return byModuleNameOnly(result, 1042 /* Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 */, 1043 /* Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0 */);
|
|
234
|
+
case 175 /* SyntaxKind.MethodDeclaration */:
|
|
235
|
+
case 174 /* SyntaxKind.MethodSignature */:
|
|
236
|
+
if (isStatic(node))
|
|
237
|
+
return byModuleName(result, 1044 /* Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named */, 1045 /* Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 */, 1046 /* Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0 */);
|
|
238
|
+
if (node.parent.kind === 264 /* SyntaxKind.ClassDeclaration */)
|
|
239
|
+
return byModuleName(result, 1047 /* Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named */, 1048 /* Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 */, 1049 /* Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0 */);
|
|
240
|
+
return byModuleNameOnly(result, 1050 /* Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1 */, 1051 /* Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0 */);
|
|
241
|
+
case 263 /* SyntaxKind.FunctionDeclaration */:
|
|
242
|
+
return byModuleName(result, 1052 /* Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named */, 1053 /* Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1 */, 1054 /* Diagnostics.Return_type_of_exported_function_has_or_is_using_private_name_0 */);
|
|
243
|
+
}
|
|
244
|
+
throw new Error('This is unknown kind for signature');
|
|
245
|
+
}
|
|
246
|
+
function parameterTypeMessage(node, result) {
|
|
247
|
+
const parent = node.parent;
|
|
248
|
+
switch (parent.kind) {
|
|
249
|
+
case 177 /* SyntaxKind.Constructor */:
|
|
250
|
+
return byModuleName(result, 1055 /* Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named */, 1056 /* Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 */, 1057 /* Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1 */);
|
|
251
|
+
case 181 /* SyntaxKind.ConstructSignature */:
|
|
252
|
+
case 186 /* SyntaxKind.ConstructorType */:
|
|
253
|
+
return byModuleNameOnly(result, 1058 /* Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 */, 1059 /* Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1 */);
|
|
254
|
+
case 180 /* SyntaxKind.CallSignature */:
|
|
255
|
+
return byModuleNameOnly(result, 1060 /* Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 */, 1061 /* Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1 */);
|
|
256
|
+
case 182 /* SyntaxKind.IndexSignature */:
|
|
257
|
+
return byModuleNameOnly(result, 1078 /* Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 */, 1079 /* Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1 */);
|
|
258
|
+
case 175 /* SyntaxKind.MethodDeclaration */:
|
|
259
|
+
case 174 /* SyntaxKind.MethodSignature */:
|
|
260
|
+
if (isStatic(parent))
|
|
261
|
+
return byModuleName(result, 1062 /* Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named */, 1063 /* Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 */, 1064 /* Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1 */);
|
|
262
|
+
if (parent.parent.kind === 264 /* SyntaxKind.ClassDeclaration */)
|
|
263
|
+
return byModuleName(result, 1065 /* Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named */, 1066 /* Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 */, 1067 /* Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1 */);
|
|
264
|
+
return byModuleNameOnly(result, 1068 /* Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 */, 1069 /* Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1 */);
|
|
265
|
+
case 263 /* SyntaxKind.FunctionDeclaration */:
|
|
266
|
+
case 185 /* SyntaxKind.FunctionType */:
|
|
267
|
+
return byModuleName(result, 1070 /* Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named */, 1071 /* Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 */, 1072 /* Diagnostics.Parameter_0_of_exported_function_has_or_is_using_private_name_1 */);
|
|
268
|
+
case 179 /* SyntaxKind.SetAccessor */:
|
|
269
|
+
case 178 /* SyntaxKind.GetAccessor */:
|
|
270
|
+
return byModuleName(result, 1094 /* Diagnostics.Parameter_0_of_accessor_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named */, 1093 /* Diagnostics.Parameter_0_of_accessor_has_or_is_using_name_1_from_private_module_2 */, 1092 /* Diagnostics.Parameter_0_of_accessor_has_or_is_using_private_name_1 */);
|
|
271
|
+
}
|
|
272
|
+
throw new Error('Unknown parent for parameter');
|
|
273
|
+
}
|
|
274
|
+
function typeParameterConstraintMessage(node) {
|
|
275
|
+
const parent = node.parent;
|
|
276
|
+
switch (parent.kind) {
|
|
277
|
+
case 264 /* SyntaxKind.ClassDeclaration */:
|
|
278
|
+
return 1005 /* Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1 */;
|
|
279
|
+
case 265 /* SyntaxKind.InterfaceDeclaration */:
|
|
280
|
+
return 1006 /* Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1 */;
|
|
281
|
+
case 201 /* SyntaxKind.MappedType */:
|
|
282
|
+
return 1089 /* Diagnostics.Type_parameter_0_of_exported_mapped_object_type_is_using_private_name_1 */;
|
|
283
|
+
case 186 /* SyntaxKind.ConstructorType */:
|
|
284
|
+
case 181 /* SyntaxKind.ConstructSignature */:
|
|
285
|
+
return 1007 /* Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1 */;
|
|
286
|
+
case 180 /* SyntaxKind.CallSignature */:
|
|
287
|
+
return 1008 /* Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1 */;
|
|
288
|
+
case 175 /* SyntaxKind.MethodDeclaration */:
|
|
289
|
+
case 174 /* SyntaxKind.MethodSignature */:
|
|
290
|
+
if (isStatic(parent))
|
|
291
|
+
return 1009 /* Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1 */;
|
|
292
|
+
if (parent.parent.kind === 264 /* SyntaxKind.ClassDeclaration */)
|
|
293
|
+
return 1010 /* Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1 */;
|
|
294
|
+
return 1011 /* Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1 */;
|
|
295
|
+
case 185 /* SyntaxKind.FunctionType */:
|
|
296
|
+
case 263 /* SyntaxKind.FunctionDeclaration */:
|
|
297
|
+
return 1012 /* Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1 */;
|
|
298
|
+
case 196 /* SyntaxKind.InferType */:
|
|
299
|
+
return 1077 /* Diagnostics.Extends_clause_for_inferred_type_0_has_or_is_using_private_name_1 */;
|
|
300
|
+
case 266 /* SyntaxKind.TypeAliasDeclaration */:
|
|
301
|
+
case 345 /* SyntaxKind.JSTypeAliasDeclaration */:
|
|
302
|
+
return 1075 /* Diagnostics.Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1 */;
|
|
303
|
+
}
|
|
304
|
+
throw new Error('This is unknown parent for type parameter');
|
|
305
|
+
}
|
|
306
|
+
// isolatedDeclarations
|
|
307
|
+
function relatedSuggestion(kind) {
|
|
308
|
+
switch (kind) {
|
|
309
|
+
case 220 /* SyntaxKind.ArrowFunction */:
|
|
310
|
+
case 219 /* SyntaxKind.FunctionExpression */:
|
|
311
|
+
return 1794 /* Diagnostics.Add_a_return_type_to_the_function_expression */;
|
|
312
|
+
case 175 /* SyntaxKind.MethodDeclaration */:
|
|
313
|
+
return 1798 /* Diagnostics.Add_a_return_type_to_the_method */;
|
|
314
|
+
case 178 /* SyntaxKind.GetAccessor */:
|
|
315
|
+
return 1796 /* Diagnostics.Add_a_return_type_to_the_get_accessor_declaration */;
|
|
316
|
+
case 179 /* SyntaxKind.SetAccessor */:
|
|
317
|
+
return 1797 /* Diagnostics.Add_a_type_to_parameter_of_the_set_accessor_declaration */;
|
|
318
|
+
case 263 /* SyntaxKind.FunctionDeclaration */:
|
|
319
|
+
case 181 /* SyntaxKind.ConstructSignature */:
|
|
320
|
+
return 1795 /* Diagnostics.Add_a_return_type_to_the_function_declaration */;
|
|
321
|
+
case 170 /* SyntaxKind.Parameter */:
|
|
322
|
+
return 1792 /* Diagnostics.Add_a_type_annotation_to_the_parameter_0 */;
|
|
323
|
+
case 261 /* SyntaxKind.VariableDeclaration */:
|
|
324
|
+
return 1791 /* Diagnostics.Add_a_type_annotation_to_the_variable_0 */;
|
|
325
|
+
case 173 /* SyntaxKind.PropertyDeclaration */:
|
|
326
|
+
case 172 /* SyntaxKind.PropertySignature */:
|
|
327
|
+
return 1793 /* Diagnostics.Add_a_type_annotation_to_the_property_0 */;
|
|
328
|
+
case 278 /* SyntaxKind.ExportAssignment */:
|
|
329
|
+
return 1800 /* Diagnostics.Move_the_expression_in_default_export_to_a_variable_and_add_a_type_annotation_to_it */;
|
|
330
|
+
}
|
|
331
|
+
return undefined;
|
|
332
|
+
}
|
|
333
|
+
function errorByDeclarationKind(kind) {
|
|
334
|
+
switch (kind) {
|
|
335
|
+
case 219 /* SyntaxKind.FunctionExpression */:
|
|
336
|
+
case 263 /* SyntaxKind.FunctionDeclaration */:
|
|
337
|
+
case 220 /* SyntaxKind.ArrowFunction */:
|
|
338
|
+
return 1772 /* Diagnostics.Function_must_have_an_explicit_return_type_annotation_with_isolatedDeclarations */;
|
|
339
|
+
case 175 /* SyntaxKind.MethodDeclaration */:
|
|
340
|
+
case 181 /* SyntaxKind.ConstructSignature */:
|
|
341
|
+
return 1773 /* Diagnostics.Method_must_have_an_explicit_return_type_annotation_with_isolatedDeclarations */;
|
|
342
|
+
case 178 /* SyntaxKind.GetAccessor */:
|
|
343
|
+
case 179 /* SyntaxKind.SetAccessor */:
|
|
344
|
+
return 1774 /* Diagnostics.At_least_one_accessor_must_have_an_explicit_type_annotation_with_isolatedDeclarations */;
|
|
345
|
+
case 170 /* SyntaxKind.Parameter */:
|
|
346
|
+
return 1776 /* Diagnostics.Parameter_must_have_an_explicit_type_annotation_with_isolatedDeclarations */;
|
|
347
|
+
case 261 /* SyntaxKind.VariableDeclaration */:
|
|
348
|
+
return 1775 /* Diagnostics.Variable_must_have_an_explicit_type_annotation_with_isolatedDeclarations */;
|
|
349
|
+
case 173 /* SyntaxKind.PropertyDeclaration */:
|
|
350
|
+
case 172 /* SyntaxKind.PropertySignature */:
|
|
351
|
+
return 1777 /* Diagnostics.Property_must_have_an_explicit_type_annotation_with_isolatedDeclarations */;
|
|
352
|
+
case 168 /* SyntaxKind.ComputedPropertyName */:
|
|
353
|
+
return 1802 /* Diagnostics.Computed_property_names_on_class_or_object_literals_cannot_be_inferred_with_isolatedDeclarations */;
|
|
354
|
+
case 305 /* SyntaxKind.SpreadAssignment */:
|
|
355
|
+
return 1780 /* Diagnostics.Objects_that_contain_spread_assignments_can_t_be_inferred_with_isolatedDeclarations */;
|
|
356
|
+
case 304 /* SyntaxKind.ShorthandPropertyAssignment */:
|
|
357
|
+
return 1781 /* Diagnostics.Objects_that_contain_shorthand_properties_can_t_be_inferred_with_isolatedDeclarations */;
|
|
358
|
+
case 210 /* SyntaxKind.ArrayLiteralExpression */:
|
|
359
|
+
return 1782 /* Diagnostics.Only_const_arrays_can_be_inferred_with_isolatedDeclarations */;
|
|
360
|
+
case 278 /* SyntaxKind.ExportAssignment */:
|
|
361
|
+
return 1801 /* Diagnostics.Default_exports_can_t_be_inferred_with_isolatedDeclarations */;
|
|
362
|
+
case 231 /* SyntaxKind.SpreadElement */:
|
|
363
|
+
return 1783 /* Diagnostics.Arrays_with_spread_elements_can_t_inferred_with_isolatedDeclarations */;
|
|
364
|
+
}
|
|
365
|
+
return 1778 /* Diagnostics.Expression_type_can_t_be_inferred_with_isolatedDeclarations */;
|
|
366
|
+
}
|
|
367
|
+
function related(node, kind, name) {
|
|
368
|
+
const message = relatedSuggestion(kind);
|
|
369
|
+
return message === undefined ? undefined : createDiagnosticForNode(node, message, [name]);
|
|
370
|
+
}
|
|
371
|
+
function isDeclarationEnoughForErrors(node) {
|
|
372
|
+
return (node.kind === 278 /* SyntaxKind.ExportAssignment */ ||
|
|
373
|
+
isStatement(node) ||
|
|
374
|
+
node.kind === 261 /* SyntaxKind.VariableDeclaration */ ||
|
|
375
|
+
node.kind === 173 /* SyntaxKind.PropertyDeclaration */ ||
|
|
376
|
+
node.kind === 170 /* SyntaxKind.Parameter */);
|
|
377
|
+
}
|
|
378
|
+
function findNearestDeclaration(node) {
|
|
379
|
+
let result = node;
|
|
380
|
+
while (result !== undefined && !isDeclarationEnoughForErrors(result))
|
|
381
|
+
result = result.parent;
|
|
382
|
+
if (result === undefined || result.kind === 278 /* SyntaxKind.ExportAssignment */)
|
|
383
|
+
return result;
|
|
384
|
+
if (result.kind === 254 /* SyntaxKind.ReturnStatement */) {
|
|
385
|
+
let fn = result;
|
|
386
|
+
while (fn !== undefined && !(isFunctionLikeDeclarationKind(fn.kind) && fn.kind !== 177 /* SyntaxKind.Constructor */))
|
|
387
|
+
fn = fn.parent;
|
|
388
|
+
return fn;
|
|
389
|
+
}
|
|
390
|
+
if (isStatement(result))
|
|
391
|
+
return undefined;
|
|
392
|
+
return result;
|
|
393
|
+
}
|
|
394
|
+
function declarationNameText(declaration) {
|
|
395
|
+
if (declaration.kind === 278 /* SyntaxKind.ExportAssignment */)
|
|
396
|
+
return '';
|
|
397
|
+
const name = getName(declaration);
|
|
398
|
+
return name === undefined ? '' : textOfNode(name);
|
|
399
|
+
}
|
|
400
|
+
function addParentDeclarationRelatedInfo(node, diagnostic) {
|
|
401
|
+
const declaration = findNearestDeclaration(node);
|
|
402
|
+
if (declaration !== undefined)
|
|
403
|
+
diagnostic.addRelatedInfo(related(declaration, declaration.kind, declarationNameText(declaration)));
|
|
404
|
+
return diagnostic;
|
|
405
|
+
}
|
|
406
|
+
function isOuterExpressionForErrors(node) {
|
|
407
|
+
switch (node.kind) {
|
|
408
|
+
case 218 /* SyntaxKind.ParenthesizedExpression */:
|
|
409
|
+
case 235 /* SyntaxKind.AsExpression */:
|
|
410
|
+
case 217 /* SyntaxKind.TypeAssertionExpression */:
|
|
411
|
+
case 239 /* SyntaxKind.SatisfiesExpression */:
|
|
412
|
+
return true;
|
|
413
|
+
}
|
|
414
|
+
return false;
|
|
415
|
+
}
|
|
416
|
+
function expressionError(node, message) {
|
|
417
|
+
const declaration = findNearestDeclaration(node);
|
|
418
|
+
if (declaration === undefined)
|
|
419
|
+
return createDiagnosticForNode(node, message ?? 1778 /* Diagnostics.Expression_type_can_t_be_inferred_with_isolatedDeclarations */, []);
|
|
420
|
+
const name = declarationNameText(declaration);
|
|
421
|
+
// The nearest ancestor that isn't a parenthesis or assertion, unless a statement comes first.
|
|
422
|
+
let parent = node.parent;
|
|
423
|
+
while (parent !== undefined) {
|
|
424
|
+
if (parent.kind === 278 /* SyntaxKind.ExportAssignment */)
|
|
425
|
+
break;
|
|
426
|
+
if (isStatement(parent)) {
|
|
427
|
+
parent = undefined;
|
|
428
|
+
break;
|
|
429
|
+
}
|
|
430
|
+
if (!isOuterExpressionForErrors(parent))
|
|
431
|
+
break;
|
|
432
|
+
parent = parent.parent;
|
|
433
|
+
}
|
|
434
|
+
if (declaration === parent) {
|
|
435
|
+
const diagnostic = createDiagnosticForNode(node, message ?? errorByDeclarationKind(declaration.kind), []);
|
|
436
|
+
return diagnostic.addRelatedInfo(related(declaration, declaration.kind, name));
|
|
437
|
+
}
|
|
438
|
+
const diagnostic = createDiagnosticForNode(node, message ?? 1778 /* Diagnostics.Expression_type_can_t_be_inferred_with_isolatedDeclarations */, []);
|
|
439
|
+
diagnostic.addRelatedInfo(related(declaration, declaration.kind, name));
|
|
440
|
+
return diagnostic.addRelatedInfo(createDiagnosticForNode(node, 1799 /* Diagnostics.Add_satisfies_and_a_type_assertion_to_this_expression_satisfies_T_as_T_to_make_the_type_explicit */, []));
|
|
441
|
+
}
|
|
442
|
+
function accessorTypeError(node) {
|
|
443
|
+
const accessors = getAllAccessorDeclarations(node);
|
|
444
|
+
const parameters = getParameters(node);
|
|
445
|
+
const target = node instanceof SetAccessorDeclaration && parameters !== undefined && parameters.nodes.length > 0
|
|
446
|
+
? parameters.nodes[0]
|
|
447
|
+
: node;
|
|
448
|
+
const diagnostic = createDiagnosticForNode(target, errorByDeclarationKind(node.kind), []);
|
|
449
|
+
if (accessors.setAccessor !== undefined)
|
|
450
|
+
diagnostic.addRelatedInfo(related(accessors.setAccessor, 179 /* SyntaxKind.SetAccessor */, ''));
|
|
451
|
+
if (accessors.getAccessor !== undefined)
|
|
452
|
+
diagnostic.addRelatedInfo(related(accessors.getAccessor, 178 /* SyntaxKind.GetAccessor */, ''));
|
|
453
|
+
return diagnostic;
|
|
454
|
+
}
|
|
455
|
+
/** The isolatedDeclarations error for a type that needs inference at `node`. */
|
|
456
|
+
export function createIsolatedDeclarationError(node, requiresAddingUndefined) {
|
|
457
|
+
for (let current = node; current !== undefined; current = current.parent)
|
|
458
|
+
if (current.kind === 299 /* SyntaxKind.HeritageClause */)
|
|
459
|
+
return createDiagnosticForNode(node, 1786 /* Diagnostics.Extends_clause_can_t_contain_an_expression_with_isolatedDeclarations */, []);
|
|
460
|
+
if (isTypeNodeKind(node.kind) || node.kind === 187 /* SyntaxKind.TypeQuery */ || isEntityNameExpression(node, false))
|
|
461
|
+
return addParentDeclarationRelatedInfo(node, createDiagnosticForNode(node, 1803 /* Diagnostics.Type_containing_private_name_0_can_t_be_used_with_isolatedDeclarations */, [textOfNode(node)]));
|
|
462
|
+
switch (node.kind) {
|
|
463
|
+
case 167 /* SyntaxKind.QualifiedName */:
|
|
464
|
+
return addParentDeclarationRelatedInfo(node, createDiagnosticForNode(node, 1803 /* Diagnostics.Type_containing_private_name_0_can_t_be_used_with_isolatedDeclarations */, [textOfNode(node)]));
|
|
465
|
+
case 178 /* SyntaxKind.GetAccessor */:
|
|
466
|
+
case 179 /* SyntaxKind.SetAccessor */:
|
|
467
|
+
return accessorTypeError(node);
|
|
468
|
+
case 168 /* SyntaxKind.ComputedPropertyName */:
|
|
469
|
+
case 304 /* SyntaxKind.ShorthandPropertyAssignment */:
|
|
470
|
+
case 305 /* SyntaxKind.SpreadAssignment */:
|
|
471
|
+
case 210 /* SyntaxKind.ArrayLiteralExpression */:
|
|
472
|
+
case 231 /* SyntaxKind.SpreadElement */:
|
|
473
|
+
return addParentDeclarationRelatedInfo(node, createDiagnosticForNode(node, errorByDeclarationKind(node.kind), []));
|
|
474
|
+
case 175 /* SyntaxKind.MethodDeclaration */:
|
|
475
|
+
case 181 /* SyntaxKind.ConstructSignature */:
|
|
476
|
+
case 219 /* SyntaxKind.FunctionExpression */:
|
|
477
|
+
case 220 /* SyntaxKind.ArrowFunction */:
|
|
478
|
+
case 263 /* SyntaxKind.FunctionDeclaration */: {
|
|
479
|
+
const diagnostic = addParentDeclarationRelatedInfo(node, createDiagnosticForNode(node, errorByDeclarationKind(node.kind), []));
|
|
480
|
+
return diagnostic.addRelatedInfo(related(node, node.kind, ''));
|
|
481
|
+
}
|
|
482
|
+
case 209 /* SyntaxKind.BindingElement */:
|
|
483
|
+
return createDiagnosticForNode(node, 1784 /* Diagnostics.Binding_elements_can_t_be_exported_directly_with_isolatedDeclarations */, []);
|
|
484
|
+
case 173 /* SyntaxKind.PropertyDeclaration */:
|
|
485
|
+
case 261 /* SyntaxKind.VariableDeclaration */: {
|
|
486
|
+
const diagnostic = createDiagnosticForNode(node, errorByDeclarationKind(node.kind), []);
|
|
487
|
+
const name = getName(node);
|
|
488
|
+
return diagnostic.addRelatedInfo(related(node, node.kind, name === undefined ? '' : textOfNode(name)));
|
|
489
|
+
}
|
|
490
|
+
case 170 /* SyntaxKind.Parameter */:
|
|
491
|
+
return parameterError(node, requiresAddingUndefined);
|
|
492
|
+
case 303 /* SyntaxKind.PropertyAssignment */:
|
|
493
|
+
return expressionError(getInitializer(node), undefined);
|
|
494
|
+
case 232 /* SyntaxKind.ClassExpression */:
|
|
495
|
+
return expressionError(node, 1787 /* Diagnostics.Inference_from_class_expressions_is_not_supported_with_isolatedDeclarations */);
|
|
496
|
+
}
|
|
497
|
+
return expressionError(node, undefined);
|
|
498
|
+
}
|
|
499
|
+
function parameterError(node, requiresAddingUndefined) {
|
|
500
|
+
if (node.parent !== undefined && node.parent.kind === 179 /* SyntaxKind.SetAccessor */)
|
|
501
|
+
return accessorTypeError(node.parent);
|
|
502
|
+
const initializer = getInitializer(node);
|
|
503
|
+
if (!requiresAddingUndefined && initializer !== undefined)
|
|
504
|
+
return expressionError(initializer, undefined);
|
|
505
|
+
const message = requiresAddingUndefined
|
|
506
|
+
? 1789 /* Diagnostics.Declaration_emit_for_this_parameter_requires_implicitly_adding_undefined_to_its_type_This_is_not_supported_with_isolatedDeclarations */
|
|
507
|
+
: errorByDeclarationKind(node.kind);
|
|
508
|
+
const diagnostic = createDiagnosticForNode(node, message, []);
|
|
509
|
+
const name = node instanceof ParameterDeclaration ? textOfNode(node.name) : '';
|
|
510
|
+
return diagnostic.addRelatedInfo(related(node, node.kind, name));
|
|
511
|
+
}
|
|
512
|
+
export class AllAccessorDeclarations {
|
|
513
|
+
firstAccessor;
|
|
514
|
+
secondAccessor;
|
|
515
|
+
getAccessor;
|
|
516
|
+
setAccessor;
|
|
517
|
+
constructor(firstAccessor, secondAccessor, getAccessor, setAccessor) {
|
|
518
|
+
this.firstAccessor = firstAccessor;
|
|
519
|
+
this.secondAccessor = secondAccessor;
|
|
520
|
+
this.getAccessor = getAccessor;
|
|
521
|
+
this.setAccessor = setAccessor;
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
/** The get and set accessors declaring the same property as `accessor`. */
|
|
525
|
+
export function getAllAccessorDeclarations(accessor) {
|
|
526
|
+
const otherKind = accessor.kind === 179 /* SyntaxKind.SetAccessor */ ? 178 /* SyntaxKind.GetAccessor */ : 179 /* SyntaxKind.SetAccessor */;
|
|
527
|
+
let other = undefined;
|
|
528
|
+
const symbol = getSymbol(accessor);
|
|
529
|
+
if (symbol !== undefined)
|
|
530
|
+
for (const declaration of symbol.declarations)
|
|
531
|
+
if (declaration.kind === otherKind) {
|
|
532
|
+
other = declaration;
|
|
533
|
+
break;
|
|
534
|
+
}
|
|
535
|
+
const otherFirst = other !== undefined && other.pos < accessor.pos;
|
|
536
|
+
const isSet = accessor.kind === 179 /* SyntaxKind.SetAccessor */;
|
|
537
|
+
return new AllAccessorDeclarations(otherFirst ? other : accessor, otherFirst ? accessor : other, isSet ? other : accessor, isSet ? accessor : other);
|
|
538
|
+
}
|