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,579 @@
|
|
|
1
|
+
// Declaration emit's queries answered by the checker, as tsgo's emit resolver: visibility and
|
|
2
|
+
// accessibility from resolved symbols, and type nodes built from types. JavaScript emit's
|
|
3
|
+
// queries, enum values and references between files are answered syntactically, except how
|
|
4
|
+
// decorator metadata serializes a type reference, which comes from the referenced type.
|
|
5
|
+
import { BigIntLiteral, BinaryExpression, ElementAccessExpression, ExportAssignment, ExportSpecifier, ExpressionStatement, ImportEqualsDeclaration, IndexSignatureDeclaration, NodeVisitor, PrefixUnaryExpression, PropertyAccessExpression, PropertyDeclaration, SourceFile, VariableDeclaration, Token, getBody, getExpression, getName, getPostfixToken, getQuestionToken, getText, getSymbol, } from './ast.js';
|
|
6
|
+
import { nodeIsPresent } from './ast-utilities.js';
|
|
7
|
+
import { getAssignmentDeclarationKind, getCombinedModifierFlags, getCombinedNodeFlags, getSourceFileOfNode, isEntityNameExpression, isParameterPropertyDeclaration, isStringOrNumericLiteralLike, } from './binder-utilities.js';
|
|
8
|
+
import { getEffectiveDeclarationFlags } from './checker-declarations.js';
|
|
9
|
+
import { getBaseTypes, getDeclaredTypeOfSymbol, isConstructorType } from './checker-declared-types.js';
|
|
10
|
+
import { getResolvedSymbol } from './checker-expressions.js';
|
|
11
|
+
import { tryGetNameFromEntityNameExpression } from './checker-narrowing.js';
|
|
12
|
+
import { getIndexInfosOfType, getIndexSymbol, getPropertiesOfType, getPropertyOfType, getSignaturesOfType, } from './checker-members.js';
|
|
13
|
+
import { getExternalModuleFileFromDeclaration, getTargetOfExportSpecifier, getTypeOnlyAliasDeclarationOfMeaning, isTypeOnlyImportOrExportDeclaration, } from './checker-modules.js';
|
|
14
|
+
import { getIndexInfosOfIndexSymbol, getSignatureFromDeclaration, getSignaturesOfSymbol, } from './checker-signatures.js';
|
|
15
|
+
import { getTypeOfSymbol, getWidenedType, isReadonlySymbol } from './checker-symbol-types.js';
|
|
16
|
+
import { getExportsOfModule, getFirstIdentifier, getGlobalSymbol, getGlobalValueSymbol, getMergedSymbol, getMembersOfSymbol, getSymbolOfDeclaration, resolveAlias, resolveEntityName, resolveName, } from './checker-symbols.js';
|
|
17
|
+
import { isArrayType, isErrorType, isFreshLiteralType, isTupleType } from './checker-type-factory.js';
|
|
18
|
+
import { isTypeAssignableToKind } from './checker-type-operators.js';
|
|
19
|
+
import { hasLateBindableName } from './checker-utilities.js';
|
|
20
|
+
import { NodeBuilder, isEntityNameVisible, isOptionalParameter } from './node-builder.js';
|
|
21
|
+
import { getRegularTypeOfExpression, newPseudoChecker, requiresAddingImplicitUndefinedForDeclaration, } from './node-builder-pseudo.js';
|
|
22
|
+
import { symbolToExpression } from './node-builder-names.js';
|
|
23
|
+
import { tryReuseExistingNode } from './node-builder-reuse.js';
|
|
24
|
+
import { isTypeIdenticalTo } from './relations.js';
|
|
25
|
+
import { beginDeclarationEmitVisibility, isDeclarationVisible, isSymbolAccessible, markDeclarationVisible, } from './symbol-accessibility.js';
|
|
26
|
+
import { DeclarationEmitResolver, } from './transformers/declarations-resolver.js';
|
|
27
|
+
import { SyntacticEmitResolver } from './transformers/emit-resolver.js';
|
|
28
|
+
const declarationEmitInternalFlags = 8 /* NodeBuilderInternalFlags.AllowUnresolvedNames */;
|
|
29
|
+
const aliasMeaning = 111551 /* SymbolFlags.Value */ | 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */ | 2097152 /* SymbolFlags.Alias */;
|
|
30
|
+
export class CheckerDeclarationEmitResolver extends DeclarationEmitResolver {
|
|
31
|
+
checker;
|
|
32
|
+
/** Answers the queries that don't need types. */
|
|
33
|
+
syntactic;
|
|
34
|
+
aliasesMarked;
|
|
35
|
+
constructor(checker, syntactic) {
|
|
36
|
+
super();
|
|
37
|
+
this.checker = checker;
|
|
38
|
+
this.syntactic = syntactic;
|
|
39
|
+
this.aliasesMarked = new Set();
|
|
40
|
+
}
|
|
41
|
+
// JavaScript emit
|
|
42
|
+
markLinkedReferences(file) {
|
|
43
|
+
return this.syntactic.markLinkedReferences(file);
|
|
44
|
+
}
|
|
45
|
+
isReferencedAliasDeclaration(node) {
|
|
46
|
+
return this.syntactic.isReferencedAliasDeclaration(node);
|
|
47
|
+
}
|
|
48
|
+
isValueAliasDeclaration(node) {
|
|
49
|
+
return this.syntactic.isValueAliasDeclaration(node);
|
|
50
|
+
}
|
|
51
|
+
isTopLevelValueImportEqualsWithEntityName(node) {
|
|
52
|
+
return this.syntactic.isTopLevelValueImportEqualsWithEntityName(node);
|
|
53
|
+
}
|
|
54
|
+
getTypeReferenceSerializationKind(typeName, location) {
|
|
55
|
+
return getTypeReferenceSerializationKind(this.checker, typeName, location);
|
|
56
|
+
}
|
|
57
|
+
getReferencedExportContainer(node, prefixLocals) {
|
|
58
|
+
return this.syntactic.getReferencedExportContainer(node, prefixLocals);
|
|
59
|
+
}
|
|
60
|
+
getReferencedImportDeclaration(node) {
|
|
61
|
+
return this.syntactic.getReferencedImportDeclaration(node);
|
|
62
|
+
}
|
|
63
|
+
getReferencedValueDeclaration(node) {
|
|
64
|
+
return this.syntactic.getReferencedValueDeclaration(node);
|
|
65
|
+
}
|
|
66
|
+
getReferencedValueDeclarations(node) {
|
|
67
|
+
return this.syntactic.getReferencedValueDeclarations(node);
|
|
68
|
+
}
|
|
69
|
+
getEnumMemberValue(member) {
|
|
70
|
+
return this.syntactic.getEnumMemberValue(member);
|
|
71
|
+
}
|
|
72
|
+
setReferencedImportDeclaration(name, declaration) {
|
|
73
|
+
this.syntactic.setReferencedImportDeclaration(name, declaration);
|
|
74
|
+
}
|
|
75
|
+
getJsxFactoryEntity(file) {
|
|
76
|
+
return this.syntactic.getJsxFactoryEntity(file);
|
|
77
|
+
}
|
|
78
|
+
getJsxFragmentFactoryEntity(file) {
|
|
79
|
+
return this.syntactic.getJsxFragmentFactoryEntity(file);
|
|
80
|
+
}
|
|
81
|
+
getConstantValue(node) {
|
|
82
|
+
return this.syntactic.getConstantValue(node);
|
|
83
|
+
}
|
|
84
|
+
// Visibility
|
|
85
|
+
precalculateDeclarationEmitVisibility(file) {
|
|
86
|
+
beginDeclarationEmitVisibility(this.checker, file);
|
|
87
|
+
if (this.aliasesMarked.has(file))
|
|
88
|
+
return false;
|
|
89
|
+
this.aliasesMarked.add(file);
|
|
90
|
+
file.forEachChild(new AliasMarker(this));
|
|
91
|
+
return true;
|
|
92
|
+
}
|
|
93
|
+
/** Marks the declarations an export names visible, following `import x = a.b` chains. */
|
|
94
|
+
markLinkedAliases(node) {
|
|
95
|
+
const c = this.checker;
|
|
96
|
+
const parent = node.parent;
|
|
97
|
+
let exportSymbol = undefined;
|
|
98
|
+
if (node.kind !== 10 /* SyntaxKind.StringLiteral */ &&
|
|
99
|
+
parent !== undefined &&
|
|
100
|
+
(parent.kind === 278 /* SyntaxKind.ExportAssignment */ || isCommonJSModuleExports(parent)))
|
|
101
|
+
exportSymbol = resolveName(c, node, getText(node), aliasMeaning, undefined, false, false);
|
|
102
|
+
else if (parent !== undefined && parent.kind === 282 /* SyntaxKind.ExportSpecifier */)
|
|
103
|
+
exportSymbol = getTargetOfExportSpecifier(c, parent, aliasMeaning, false);
|
|
104
|
+
const visited = new Set();
|
|
105
|
+
while (exportSymbol !== undefined && !visited.has(exportSymbol)) {
|
|
106
|
+
visited.add(exportSymbol);
|
|
107
|
+
let next = undefined;
|
|
108
|
+
for (const declaration of exportSymbol.declarations) {
|
|
109
|
+
markDeclarationVisible(c, declaration);
|
|
110
|
+
if (declaration instanceof ImportEqualsDeclaration &&
|
|
111
|
+
declaration.moduleReference.kind !== 284 /* SyntaxKind.ExternalModuleReference */) {
|
|
112
|
+
const first = getFirstIdentifier(declaration.moduleReference);
|
|
113
|
+
next = resolveName(c, declaration, getText(first), aliasMeaning, undefined, false, false);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
exportSymbol = next;
|
|
117
|
+
}
|
|
118
|
+
return true;
|
|
119
|
+
}
|
|
120
|
+
isDeclarationVisible(node) {
|
|
121
|
+
return isDeclarationVisible(this.checker, node);
|
|
122
|
+
}
|
|
123
|
+
isEntityNameVisible(entityName, enclosingDeclaration) {
|
|
124
|
+
return isEntityNameVisible(this.checker, entityName, enclosingDeclaration, true);
|
|
125
|
+
}
|
|
126
|
+
isSymbolAccessible(symbol, enclosingDeclaration, meaning, shouldComputeAliasesToMakeVisible) {
|
|
127
|
+
return isSymbolAccessible(this.checker, symbol, enclosingDeclaration, meaning, shouldComputeAliasesToMakeVisible);
|
|
128
|
+
}
|
|
129
|
+
isNameResolvable(location, name) {
|
|
130
|
+
const meaning = 111551 /* SymbolFlags.Value */ | 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */;
|
|
131
|
+
return resolveName(this.checker, location, name, meaning, undefined, false, false) !== undefined;
|
|
132
|
+
}
|
|
133
|
+
isImportRequiredByAugmentation(node) {
|
|
134
|
+
if ((node.flags & 16 /* NodeFlags.Synthesized */) !== 0)
|
|
135
|
+
return false;
|
|
136
|
+
const c = this.checker;
|
|
137
|
+
const file = getSourceFileOfNode(node);
|
|
138
|
+
if (file.symbol === undefined)
|
|
139
|
+
return false;
|
|
140
|
+
const importTarget = getExternalModuleFileFromDeclaration(c, node);
|
|
141
|
+
if (importTarget === undefined || importTarget === file)
|
|
142
|
+
return false;
|
|
143
|
+
for (const s of getExportsOfModule(c, file.symbol).values()) {
|
|
144
|
+
const merged = getMergedSymbol(c, s);
|
|
145
|
+
if (merged === s)
|
|
146
|
+
continue;
|
|
147
|
+
for (const d of merged.declarations)
|
|
148
|
+
if (getSourceFileOfNode(d) === importTarget)
|
|
149
|
+
return true;
|
|
150
|
+
}
|
|
151
|
+
return false;
|
|
152
|
+
}
|
|
153
|
+
// Declarations
|
|
154
|
+
getEffectiveDeclarationFlags(node, flags) {
|
|
155
|
+
return getEffectiveDeclarationFlags(node, flags);
|
|
156
|
+
}
|
|
157
|
+
isImplementationOfOverload(node) {
|
|
158
|
+
if ((node.flags & 16 /* NodeFlags.Synthesized */) !== 0 || !nodeIsPresent(getBody(node)))
|
|
159
|
+
return false;
|
|
160
|
+
// Accessors have up to two signatures but never overloads.
|
|
161
|
+
if (node.kind === 178 /* SyntaxKind.GetAccessor */ || node.kind === 179 /* SyntaxKind.SetAccessor */)
|
|
162
|
+
return false;
|
|
163
|
+
const c = this.checker;
|
|
164
|
+
const signatures = getSignaturesOfSymbol(c, getSymbolOfDeclaration(c, node));
|
|
165
|
+
if (signatures.length > 1)
|
|
166
|
+
return true;
|
|
167
|
+
if (signatures.length === 1) {
|
|
168
|
+
const declaration = signatures[0].declaration;
|
|
169
|
+
if (declaration !== node && declaration !== undefined && (declaration.flags & 4194304 /* NodeFlags.JSDoc */) === 0)
|
|
170
|
+
return true;
|
|
171
|
+
}
|
|
172
|
+
return false;
|
|
173
|
+
}
|
|
174
|
+
isLateBound(node) {
|
|
175
|
+
if ((node.flags & 16 /* NodeFlags.Synthesized */) !== 0)
|
|
176
|
+
return false;
|
|
177
|
+
const symbol = getSymbolOfDeclaration(this.checker, node);
|
|
178
|
+
return symbol !== undefined && (symbol.checkFlags & 4096 /* CheckFlags.Late */) !== 0;
|
|
179
|
+
}
|
|
180
|
+
isDefinitelyReferenceToGlobalSymbolObject(node) {
|
|
181
|
+
if (!(node instanceof PropertyAccessExpression) || node.name.kind !== 79 /* SyntaxKind.Identifier */)
|
|
182
|
+
return false;
|
|
183
|
+
const c = this.checker;
|
|
184
|
+
const expression = node.expression;
|
|
185
|
+
if (expression.kind === 79 /* SyntaxKind.Identifier */) {
|
|
186
|
+
if (getText(expression) !== 'Symbol')
|
|
187
|
+
return false;
|
|
188
|
+
// `Symbol` doesn't resolve or is the global `Symbol`.
|
|
189
|
+
return (getResolvedSymbol(c, expression) ===
|
|
190
|
+
getGlobalSymbol(c, 'Symbol', 111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */, undefined));
|
|
191
|
+
}
|
|
192
|
+
if (!(expression instanceof PropertyAccessExpression))
|
|
193
|
+
return false;
|
|
194
|
+
const inner = expression.expression;
|
|
195
|
+
if (inner.kind !== 79 /* SyntaxKind.Identifier */ ||
|
|
196
|
+
getText(inner) !== 'globalThis' ||
|
|
197
|
+
getText(expression.name) !== 'Symbol')
|
|
198
|
+
return false;
|
|
199
|
+
return getResolvedSymbol(c, inner) === c.globalThisSymbol;
|
|
200
|
+
}
|
|
201
|
+
isLiteralConstDeclaration(node) {
|
|
202
|
+
if ((node.flags & 16 /* NodeFlags.Synthesized */) !== 0)
|
|
203
|
+
return false;
|
|
204
|
+
const isConstVariable = node instanceof VariableDeclaration && (getCombinedNodeFlags(node) & 7 /* NodeFlags.BlockScoped */) === 2 /* NodeFlags.Const */;
|
|
205
|
+
if (!isDeclarationReadonly(node) && !isConstVariable)
|
|
206
|
+
return false;
|
|
207
|
+
const c = this.checker;
|
|
208
|
+
const symbol = getSymbolOfDeclaration(c, node);
|
|
209
|
+
return symbol !== undefined && isFreshLiteralType(getTypeOfSymbol(c, symbol));
|
|
210
|
+
}
|
|
211
|
+
isOptionalParameter(node) {
|
|
212
|
+
return isOptionalParameter(this.checker, node);
|
|
213
|
+
}
|
|
214
|
+
requiresAddingImplicitUndefined(node, enclosingDeclaration) {
|
|
215
|
+
return requiresAddingImplicitUndefinedForDeclaration(this.checker, node, undefined, enclosingDeclaration);
|
|
216
|
+
}
|
|
217
|
+
isExpandoFunctionDeclaration(node) {
|
|
218
|
+
if ((node.flags & 16 /* NodeFlags.Synthesized */) !== 0)
|
|
219
|
+
return false;
|
|
220
|
+
for (const p of this.getPropertiesOfContainerFunction(node))
|
|
221
|
+
if (p.valueDeclaration !== undefined && p.valueDeclaration.kind === 227 /* SyntaxKind.BinaryExpression */)
|
|
222
|
+
return true;
|
|
223
|
+
return false;
|
|
224
|
+
}
|
|
225
|
+
getExpandoPropertyDeclarations(node) {
|
|
226
|
+
const result = [];
|
|
227
|
+
for (const p of this.getPropertiesOfContainerFunction(node))
|
|
228
|
+
if (p.valueDeclaration !== undefined && p.valueDeclaration.kind === 227 /* SyntaxKind.BinaryExpression */)
|
|
229
|
+
result.push(p.valueDeclaration);
|
|
230
|
+
return result;
|
|
231
|
+
}
|
|
232
|
+
getPropertiesOfContainerFunction(node) {
|
|
233
|
+
const c = this.checker;
|
|
234
|
+
const symbol = getSymbolOfDeclaration(c, node);
|
|
235
|
+
if (symbol === undefined)
|
|
236
|
+
return [];
|
|
237
|
+
return getPropertiesOfType(c, getTypeOfSymbol(c, symbol));
|
|
238
|
+
}
|
|
239
|
+
getResolutionModeOverride(node) {
|
|
240
|
+
return this.syntactic.getResolutionModeOverride(node);
|
|
241
|
+
}
|
|
242
|
+
getSourceFileFromReference(file, reference) {
|
|
243
|
+
return this.syntactic.getSourceFileFromReference(file, reference);
|
|
244
|
+
}
|
|
245
|
+
// JavaScript
|
|
246
|
+
getReferencedMemberValueDeclaration(node) {
|
|
247
|
+
return this.syntactic.getReferencedMemberValueDeclaration(node);
|
|
248
|
+
}
|
|
249
|
+
isThisPropertyAssignmentDeclarationRedundant(node) {
|
|
250
|
+
const c = this.checker;
|
|
251
|
+
const s = getSymbolOfDeclaration(c, node);
|
|
252
|
+
if (s === undefined || s.parent === undefined)
|
|
253
|
+
return false;
|
|
254
|
+
const parentType = getDeclaredTypeOfSymbol(c, s.parent);
|
|
255
|
+
for (const base of getBaseTypes(c, parentType)) {
|
|
256
|
+
const baseProp = getPropertyOfType(c, base, s.name);
|
|
257
|
+
if (baseProp === undefined)
|
|
258
|
+
continue;
|
|
259
|
+
if ((baseProp.flags & (98304 /* SymbolFlags.Accessor */ | 8192 /* SymbolFlags.Method */ | 16 /* SymbolFlags.Function */)) !== 0)
|
|
260
|
+
return true;
|
|
261
|
+
if (isReadonlySymbol(c, baseProp) === isReadonlySymbol(c, s) &&
|
|
262
|
+
(s.flags & 16777216 /* SymbolFlags.Optional */) === (baseProp.flags & 16777216 /* SymbolFlags.Optional */) &&
|
|
263
|
+
isTypeIdenticalTo(c, getTypeOfSymbol(c, s), getTypeOfSymbol(c, baseProp)))
|
|
264
|
+
return true;
|
|
265
|
+
}
|
|
266
|
+
return false;
|
|
267
|
+
}
|
|
268
|
+
getElementAccessExpressionName(node) {
|
|
269
|
+
if (!(node instanceof ElementAccessExpression) || (node.flags & 16 /* NodeFlags.Synthesized */) !== 0)
|
|
270
|
+
return '';
|
|
271
|
+
const argument = node.argumentExpression;
|
|
272
|
+
if (isStringOrNumericLiteralLike(argument))
|
|
273
|
+
return getText(argument);
|
|
274
|
+
if (isEntityNameExpression(argument, false))
|
|
275
|
+
return tryGetNameFromEntityNameExpression(this.checker, argument) ?? '';
|
|
276
|
+
return '';
|
|
277
|
+
}
|
|
278
|
+
// Type nodes
|
|
279
|
+
builder(context, enclosingDeclaration, flags, tracker) {
|
|
280
|
+
const b = new NodeBuilder(this.checker, enclosingDeclaration, flags, declarationEmitInternalFlags, tracker, context);
|
|
281
|
+
b.pseudo = newPseudoChecker(this.checker);
|
|
282
|
+
b.declarationOrder = true;
|
|
283
|
+
return b;
|
|
284
|
+
}
|
|
285
|
+
createTypeOfDeclaration(context, declaration, enclosingDeclaration, flags, tracker) {
|
|
286
|
+
const original = context.parseNode(declaration);
|
|
287
|
+
if (original === undefined)
|
|
288
|
+
return undefined;
|
|
289
|
+
const b = this.builder(context, enclosingDeclaration, flags | 1024 /* NodeBuilderFlags.MultilineObjectLiterals */, tracker);
|
|
290
|
+
const symbol = getSymbolOfDeclaration(this.checker, declaration);
|
|
291
|
+
return b.finish(b.serializeTypeForDeclaration(declaration, undefined, symbol, true));
|
|
292
|
+
}
|
|
293
|
+
createReturnTypeOfSignatureDeclaration(context, signature, enclosingDeclaration, flags, tracker) {
|
|
294
|
+
const original = context.parseNode(signature);
|
|
295
|
+
if (original === undefined)
|
|
296
|
+
return undefined;
|
|
297
|
+
const b = this.builder(context, enclosingDeclaration, flags, tracker);
|
|
298
|
+
const sig = getSignatureFromDeclaration(this.checker, original);
|
|
299
|
+
const cleanup = b.enterSignatureScope(sig);
|
|
300
|
+
const result = b.serializeReturnTypeForSignatureEx(sig, true);
|
|
301
|
+
cleanup();
|
|
302
|
+
return b.finish(result);
|
|
303
|
+
}
|
|
304
|
+
createTypeParametersOfSignatureDeclaration(context, signature, enclosingDeclaration, flags, tracker) {
|
|
305
|
+
const original = context.parseNode(signature);
|
|
306
|
+
if (original === undefined)
|
|
307
|
+
return undefined;
|
|
308
|
+
const symbol = getSymbolOfDeclaration(this.checker, original);
|
|
309
|
+
if (symbol === undefined)
|
|
310
|
+
return undefined;
|
|
311
|
+
const b = this.builder(context, enclosingDeclaration, flags, tracker);
|
|
312
|
+
const result = b.finish(b.typeParametersToTypeParameterDeclarations(symbol));
|
|
313
|
+
return result !== undefined && result.length > 0 ? result : undefined;
|
|
314
|
+
}
|
|
315
|
+
createLiteralConstValue(context, nodeIn, tracker) {
|
|
316
|
+
const c = this.checker;
|
|
317
|
+
const node = context.parseNode(nodeIn) ?? nodeIn;
|
|
318
|
+
const symbol = getSymbolOfDeclaration(c, node);
|
|
319
|
+
if (symbol === undefined)
|
|
320
|
+
return undefined;
|
|
321
|
+
const t = getTypeOfSymbol(c, symbol);
|
|
322
|
+
const factory = context.factory;
|
|
323
|
+
if ((t.flags & 98304 /* TypeFlags.EnumLike */) !== 0 && t.symbol !== undefined) {
|
|
324
|
+
const b = this.builder(context, node, 0 /* NodeBuilderFlags.None */, tracker);
|
|
325
|
+
return b.finish(symbolToExpression(b, t.symbol, 111551 /* SymbolFlags.Value */));
|
|
326
|
+
}
|
|
327
|
+
if (t === c.trueType)
|
|
328
|
+
return factory.createKeywordExpression(111 /* SyntaxKind.TrueKeyword */);
|
|
329
|
+
if (t === c.falseType)
|
|
330
|
+
return factory.createKeywordExpression(96 /* SyntaxKind.FalseKeyword */);
|
|
331
|
+
if ((t.flags & 15360 /* TypeFlags.Literal */) === 0)
|
|
332
|
+
return undefined;
|
|
333
|
+
return literalValueToExpression(context, t);
|
|
334
|
+
}
|
|
335
|
+
createTypeOfExpression(context, expression, enclosingDeclaration, flags, tracker) {
|
|
336
|
+
const original = context.parseNode(expression);
|
|
337
|
+
if (original === undefined)
|
|
338
|
+
return undefined;
|
|
339
|
+
const b = this.builder(context, enclosingDeclaration, flags | 1024 /* NodeBuilderFlags.MultilineObjectLiterals */, tracker);
|
|
340
|
+
return b.finish(b.typeToTypeNode(getWidenedType(this.checker, getRegularTypeOfExpression(this.checker, original))));
|
|
341
|
+
}
|
|
342
|
+
createLateBoundIndexSignatures(context, containerIn, enclosingDeclaration, flags, tracker) {
|
|
343
|
+
const c = this.checker;
|
|
344
|
+
const container = context.parseNode(containerIn) ?? containerIn;
|
|
345
|
+
// The declaration's own symbol: members merged in from other files aren't written here.
|
|
346
|
+
const sym = getSymbol(container);
|
|
347
|
+
if (sym === undefined)
|
|
348
|
+
return [];
|
|
349
|
+
const staticInfos = getIndexInfosOfType(c, getTypeOfSymbol(c, sym));
|
|
350
|
+
const instanceIndexSymbol = getIndexSymbol(c, sym);
|
|
351
|
+
let instanceInfos = [];
|
|
352
|
+
if (instanceIndexSymbol !== undefined) {
|
|
353
|
+
const siblingSymbols = [...getMembersOfSymbol(c, sym).values()];
|
|
354
|
+
instanceInfos = getIndexInfosOfIndexSymbol(c, instanceIndexSymbol, siblingSymbols);
|
|
355
|
+
}
|
|
356
|
+
const factory = context.factory;
|
|
357
|
+
const result = [];
|
|
358
|
+
const lists = [staticInfos, instanceInfos];
|
|
359
|
+
for (let i = 0; i < lists.length; i++) {
|
|
360
|
+
const isStatic = i === 0;
|
|
361
|
+
for (const info of lists[i]) {
|
|
362
|
+
if (info.declaration !== undefined)
|
|
363
|
+
continue;
|
|
364
|
+
// Inherited, but looks late-bound as it has no declarations.
|
|
365
|
+
if (info === c.anyBaseTypeIndexInfo)
|
|
366
|
+
continue;
|
|
367
|
+
if (info.components.length > 0) {
|
|
368
|
+
if (areComponentsSerializable(c, info.components, enclosingDeclaration)) {
|
|
369
|
+
for (const component of info.components) {
|
|
370
|
+
// Late-bound members of the index signature are kept as members.
|
|
371
|
+
if (hasLateBindableName(c, component))
|
|
372
|
+
continue;
|
|
373
|
+
const name = getName(component);
|
|
374
|
+
const first = getFirstIdentifier(getExpression(name));
|
|
375
|
+
const resolved = resolveName(c, first, getText(first), 111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */, undefined, true, false);
|
|
376
|
+
if (resolved !== undefined)
|
|
377
|
+
tracker.trackSymbol(resolved, enclosingDeclaration, 111551 /* SymbolFlags.Value */);
|
|
378
|
+
const modifiers = [];
|
|
379
|
+
if (isStatic)
|
|
380
|
+
modifiers.push(factory.createToken(125 /* SyntaxKind.StaticKeyword */));
|
|
381
|
+
if (info.isReadonly)
|
|
382
|
+
modifiers.push(factory.createToken(148 /* SyntaxKind.ReadonlyKeyword */));
|
|
383
|
+
const componentSymbol = getSymbolOfDeclaration(c, component);
|
|
384
|
+
const b = this.builder(context, enclosingDeclaration, flags, tracker);
|
|
385
|
+
const typeNode = componentSymbol === undefined
|
|
386
|
+
? undefined
|
|
387
|
+
: b.finish(b.typeToTypeNode(getTypeOfSymbol(c, componentSymbol)));
|
|
388
|
+
result.push(factory.created(new PropertyDeclaration(modifiers.length > 0 ? factory.createModifierList(modifiers) : undefined, name, getQuestionTokenOf(component), typeNode, undefined)));
|
|
389
|
+
}
|
|
390
|
+
continue;
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
const b = this.builder(context, enclosingDeclaration, flags, tracker);
|
|
394
|
+
let node = b.finish(b.indexInfoToIndexSignatureDeclaration(info, undefined));
|
|
395
|
+
if (node !== undefined && isStatic)
|
|
396
|
+
node = addStaticModifier(context, node);
|
|
397
|
+
if (node !== undefined)
|
|
398
|
+
result.push(node);
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
return result;
|
|
402
|
+
}
|
|
403
|
+
tryJSTypeNodeToTypeNode(context, typeNode, enclosingDeclaration, flags, tracker) {
|
|
404
|
+
const original = context.parseNode(typeNode) ?? typeNode;
|
|
405
|
+
const b = this.builder(context, enclosingDeclaration, flags, tracker);
|
|
406
|
+
return b.finish(tryReuseExistingNode(b, original));
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
/** Visits every node, marking the declarations exports name visible. */
|
|
410
|
+
/** JavaScript emit's resolver, with decorator metadata's type references serialized from the checker's types. */
|
|
411
|
+
export class CheckerEmitResolver extends SyntacticEmitResolver {
|
|
412
|
+
checker;
|
|
413
|
+
constructor(options, referenceResolver, checker) {
|
|
414
|
+
super(options, referenceResolver);
|
|
415
|
+
this.checker = checker;
|
|
416
|
+
}
|
|
417
|
+
getTypeReferenceSerializationKind(typeName, location) {
|
|
418
|
+
return getTypeReferenceSerializationKind(this.checker, typeName, location);
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
/**
|
|
422
|
+
* How decorator metadata serializes a reference to `typeName` from `location`, as tsgo's
|
|
423
|
+
* `GetTypeReferenceSerializationKind`: the name of a class or another value with construct
|
|
424
|
+
* signatures that is reachable at runtime, else the kind of the declared type it names.
|
|
425
|
+
*/
|
|
426
|
+
export function getTypeReferenceSerializationKind(c, typeName, location) {
|
|
427
|
+
if (location === undefined)
|
|
428
|
+
return 0 /* TypeReferenceSerializationKind.Unknown */;
|
|
429
|
+
// The value must be reachable at runtime.
|
|
430
|
+
let isTypeOnly = false;
|
|
431
|
+
if (typeName.kind === 167 /* SyntaxKind.QualifiedName */) {
|
|
432
|
+
const root = resolveEntityName(c, getFirstIdentifier(typeName), 111551 /* SymbolFlags.Value */, true, true, location);
|
|
433
|
+
if (root !== undefined && root.declarations.length > 0)
|
|
434
|
+
isTypeOnly = root.declarations.every(isTypeOnlyImportOrExportDeclaration);
|
|
435
|
+
}
|
|
436
|
+
const valueSymbol = resolveEntityName(c, typeName, 111551 /* SymbolFlags.Value */, true, true, location);
|
|
437
|
+
let resolvedValue = valueSymbol;
|
|
438
|
+
if (valueSymbol !== undefined && (valueSymbol.flags & 2097152 /* SymbolFlags.Alias */) !== 0)
|
|
439
|
+
resolvedValue = resolveAlias(c, valueSymbol);
|
|
440
|
+
if (valueSymbol !== undefined &&
|
|
441
|
+
getTypeOnlyAliasDeclarationOfMeaning(c, valueSymbol, 111551 /* SymbolFlags.Value */) !== undefined)
|
|
442
|
+
isTypeOnly = true;
|
|
443
|
+
// The type gives a more specific constructor, and tells whether the value is reachable when it doesn't resolve.
|
|
444
|
+
const typeSymbol = resolveEntityName(c, typeName, 788968 /* SymbolFlags.Type */, true, true, location);
|
|
445
|
+
let resolvedType = typeSymbol;
|
|
446
|
+
if (typeSymbol !== undefined && (typeSymbol.flags & 2097152 /* SymbolFlags.Alias */) !== 0)
|
|
447
|
+
resolvedType = resolveAlias(c, typeSymbol);
|
|
448
|
+
if (typeSymbol !== undefined && getTypeOnlyAliasDeclarationOfMeaning(c, typeSymbol, 788968 /* SymbolFlags.Type */) !== undefined)
|
|
449
|
+
isTypeOnly = true;
|
|
450
|
+
if (resolvedValue !== undefined && resolvedValue === resolvedType) {
|
|
451
|
+
const promise = getGlobalValueSymbol(c, 'Promise', false);
|
|
452
|
+
if (promise !== undefined && resolvedValue === promise)
|
|
453
|
+
return 9 /* TypeReferenceSerializationKind.Promise */;
|
|
454
|
+
if (isConstructorType(c, getTypeOfSymbol(c, resolvedValue)))
|
|
455
|
+
return isTypeOnly
|
|
456
|
+
? 10 /* TypeReferenceSerializationKind.TypeWithCallSignature */
|
|
457
|
+
: 1 /* TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue */;
|
|
458
|
+
}
|
|
459
|
+
if (resolvedType === undefined)
|
|
460
|
+
return isTypeOnly ? 11 /* TypeReferenceSerializationKind.ObjectType */ : 0 /* TypeReferenceSerializationKind.Unknown */;
|
|
461
|
+
const t = getDeclaredTypeOfSymbol(c, resolvedType);
|
|
462
|
+
if (isErrorType(c, t))
|
|
463
|
+
return isTypeOnly ? 11 /* TypeReferenceSerializationKind.ObjectType */ : 0 /* TypeReferenceSerializationKind.Unknown */;
|
|
464
|
+
if ((t.flags & 3 /* TypeFlags.AnyOrUnknown */) !== 0)
|
|
465
|
+
return 11 /* TypeReferenceSerializationKind.ObjectType */;
|
|
466
|
+
if (isTypeAssignableToKind(c, t, 16 /* TypeFlags.Void */ | 12 /* TypeFlags.Nullable */ | 262144 /* TypeFlags.Never */))
|
|
467
|
+
return 2 /* TypeReferenceSerializationKind.VoidNullableOrNeverType */;
|
|
468
|
+
if (isTypeAssignableToKind(c, t, 8448 /* TypeFlags.BooleanLike */))
|
|
469
|
+
return 6 /* TypeReferenceSerializationKind.BooleanType */;
|
|
470
|
+
if (isTypeAssignableToKind(c, t, 67648 /* TypeFlags.NumberLike */))
|
|
471
|
+
return 3 /* TypeReferenceSerializationKind.NumberLikeType */;
|
|
472
|
+
if (isTypeAssignableToKind(c, t, 4224 /* TypeFlags.BigIntLike */))
|
|
473
|
+
return 4 /* TypeReferenceSerializationKind.BigIntLikeType */;
|
|
474
|
+
if (isTypeAssignableToKind(c, t, 12583968 /* TypeFlags.StringLike */))
|
|
475
|
+
return 5 /* TypeReferenceSerializationKind.StringLikeType */;
|
|
476
|
+
if (isTupleType(t))
|
|
477
|
+
return 7 /* TypeReferenceSerializationKind.ArrayLikeType */;
|
|
478
|
+
if (isTypeAssignableToKind(c, t, 16896 /* TypeFlags.ESSymbolLike */))
|
|
479
|
+
return 8 /* TypeReferenceSerializationKind.ESSymbolType */;
|
|
480
|
+
if (isFunctionType(c, t))
|
|
481
|
+
return 10 /* TypeReferenceSerializationKind.TypeWithCallSignature */;
|
|
482
|
+
if (isArrayType(c, t))
|
|
483
|
+
return 7 /* TypeReferenceSerializationKind.ArrayLikeType */;
|
|
484
|
+
return 11 /* TypeReferenceSerializationKind.ObjectType */;
|
|
485
|
+
}
|
|
486
|
+
function isFunctionType(c, t) {
|
|
487
|
+
return (t.flags & 1048576 /* TypeFlags.Object */) !== 0 && getSignaturesOfType(c, t, 0 /* SignatureKind.Call */).length > 0;
|
|
488
|
+
}
|
|
489
|
+
class AliasMarker extends NodeVisitor {
|
|
490
|
+
resolver;
|
|
491
|
+
constructor(resolver) {
|
|
492
|
+
super();
|
|
493
|
+
this.resolver = resolver;
|
|
494
|
+
}
|
|
495
|
+
visitNode(node) {
|
|
496
|
+
if (node instanceof BinaryExpression) {
|
|
497
|
+
if (isCommonJSModuleExports(node) && node.right.kind === 79 /* SyntaxKind.Identifier */)
|
|
498
|
+
this.resolver.markLinkedAliases(node.right);
|
|
499
|
+
}
|
|
500
|
+
else if (node instanceof ExportAssignment) {
|
|
501
|
+
if (node.expression.kind === 79 /* SyntaxKind.Identifier */)
|
|
502
|
+
this.resolver.markLinkedAliases(node.expression);
|
|
503
|
+
}
|
|
504
|
+
else if (node instanceof ExportSpecifier)
|
|
505
|
+
this.resolver.markLinkedAliases(node.propertyName ?? node.name);
|
|
506
|
+
return node.forEachChild(this);
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
/** `module.exports = x` or `exports.y = x` at the top of a CommonJS module. */
|
|
510
|
+
function isCommonJSModuleExports(node) {
|
|
511
|
+
if (!(node instanceof BinaryExpression))
|
|
512
|
+
return false;
|
|
513
|
+
const statement = node.parent;
|
|
514
|
+
if (!(statement instanceof ExpressionStatement))
|
|
515
|
+
return false;
|
|
516
|
+
const file = statement.parent;
|
|
517
|
+
if (!(file instanceof SourceFile) || file.commonJSModuleIndicator === undefined)
|
|
518
|
+
return false;
|
|
519
|
+
const kind = getAssignmentDeclarationKind(node);
|
|
520
|
+
return kind === 1 /* JSDeclarationKind.ModuleExports */ || kind === 2 /* JSDeclarationKind.ExportsProperty */;
|
|
521
|
+
}
|
|
522
|
+
function isDeclarationReadonly(node) {
|
|
523
|
+
return ((getCombinedModifierFlags(node) & 8 /* ModifierFlags.Readonly */) !== 0 &&
|
|
524
|
+
!(node.parent !== undefined && isParameterPropertyDeclaration(node, node.parent)));
|
|
525
|
+
}
|
|
526
|
+
function isEntityNameExpressionNode(node) {
|
|
527
|
+
if (node.kind === 79 /* SyntaxKind.Identifier */)
|
|
528
|
+
return true;
|
|
529
|
+
return (node instanceof PropertyAccessExpression &&
|
|
530
|
+
node.name.kind === 79 /* SyntaxKind.Identifier */ &&
|
|
531
|
+
isEntityNameExpressionNode(node.expression));
|
|
532
|
+
}
|
|
533
|
+
function areComponentsSerializable(c, components, enclosingDeclaration) {
|
|
534
|
+
for (const component of components) {
|
|
535
|
+
const name = getName(component);
|
|
536
|
+
if (name === undefined ||
|
|
537
|
+
name.kind !== 168 /* SyntaxKind.ComputedPropertyName */ ||
|
|
538
|
+
!isEntityNameExpressionNode(getExpression(name)) ||
|
|
539
|
+
isEntityNameVisible(c, getExpression(name), enclosingDeclaration, false).accessibility !==
|
|
540
|
+
0 /* SymbolAccessibility.Accessible */)
|
|
541
|
+
return false;
|
|
542
|
+
}
|
|
543
|
+
return true;
|
|
544
|
+
}
|
|
545
|
+
function getQuestionTokenOf(node) {
|
|
546
|
+
const token = getQuestionToken(node) ?? getPostfixToken(node);
|
|
547
|
+
return token instanceof Token && token.kind === 57 /* SyntaxKind.QuestionToken */ ? token : undefined;
|
|
548
|
+
}
|
|
549
|
+
/** The initializer for a literal type's value: a string, number or bigint literal. */
|
|
550
|
+
function literalValueToExpression(context, t) {
|
|
551
|
+
const factory = context.factory;
|
|
552
|
+
if ((t.flags & 1024 /* TypeFlags.StringLiteral */) !== 0)
|
|
553
|
+
return factory.createStringLiteral(t.stringValue, 0 /* TokenFlags.None */);
|
|
554
|
+
if ((t.flags & 2048 /* TypeFlags.NumberLiteral */) !== 0) {
|
|
555
|
+
const value = t.numberValue;
|
|
556
|
+
if (value === Infinity)
|
|
557
|
+
return factory.createIdentifier('Infinity');
|
|
558
|
+
if (value === -Infinity)
|
|
559
|
+
return factory.created(new PrefixUnaryExpression(40 /* SyntaxKind.MinusToken */, factory.createIdentifier('Infinity')));
|
|
560
|
+
if (Number.isNaN(value))
|
|
561
|
+
return factory.createIdentifier('NaN');
|
|
562
|
+
if (value < 0)
|
|
563
|
+
return factory.created(new PrefixUnaryExpression(40 /* SyntaxKind.MinusToken */, factory.createNumericLiteral(String(-value))));
|
|
564
|
+
return factory.createNumericLiteral(String(value));
|
|
565
|
+
}
|
|
566
|
+
if ((t.flags & 4096 /* TypeFlags.BigIntLiteral */) !== 0)
|
|
567
|
+
return factory.created(new BigIntLiteral(t.stringValue + 'n', 0 /* TokenFlags.None */));
|
|
568
|
+
return undefined;
|
|
569
|
+
}
|
|
570
|
+
function addStaticModifier(context, node) {
|
|
571
|
+
if (!(node instanceof IndexSignatureDeclaration))
|
|
572
|
+
return node;
|
|
573
|
+
const factory = context.factory;
|
|
574
|
+
const modifiers = [factory.createToken(125 /* SyntaxKind.StaticKeyword */)];
|
|
575
|
+
if (node.modifiers !== undefined)
|
|
576
|
+
for (const m of node.modifiers.nodes)
|
|
577
|
+
modifiers.push(m);
|
|
578
|
+
return factory.created(new IndexSignatureDeclaration(factory.createModifierList(modifiers), node.parameters, node.type));
|
|
579
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type Node } from './ast.js';
|
|
2
|
+
import type { Checker } from './checker.js';
|
|
3
|
+
export declare const enum EvaluatedKind {
|
|
4
|
+
None = 0,
|
|
5
|
+
Number = 1,
|
|
6
|
+
String = 2
|
|
7
|
+
}
|
|
8
|
+
/** How a value was evaluated, for the isolatedModules checks of enum members. */
|
|
9
|
+
export declare const enum EvaluatedFlags {
|
|
10
|
+
None = 0,
|
|
11
|
+
/** Written as a string: a string literal, a template, or `+` with one. */
|
|
12
|
+
SyntacticallyString = 1,
|
|
13
|
+
/** Read from a declaration in another file. */
|
|
14
|
+
ResolvedOtherFiles = 2
|
|
15
|
+
}
|
|
16
|
+
export declare class EvaluatorResult {
|
|
17
|
+
kind: EvaluatedKind;
|
|
18
|
+
numberValue: number;
|
|
19
|
+
stringValue: string;
|
|
20
|
+
flags: EvaluatedFlags;
|
|
21
|
+
static number(value: number): EvaluatorResult;
|
|
22
|
+
static string(value: string): EvaluatorResult;
|
|
23
|
+
}
|
|
24
|
+
/** The constant value of an enum member initializer, if it has one. */
|
|
25
|
+
export declare function evaluateEnumMember(c: Checker, expr: Node, member: Node): EvaluatorResult;
|
|
26
|
+
/** The constant value of `expr`, evaluated at `location`. */
|
|
27
|
+
export declare function evaluate(c: Checker, expr: Node, location: Node): EvaluatorResult;
|