tsc-ts 0.0.4 → 0.0.6
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 +34 -2
- 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 +2351 -0
- package/dist/api/compiler/ast.js +11212 -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 +1241 -0
- package/dist/api/compiler/binder.d.ts +33 -0
- package/dist/api/compiler/binder.js +2359 -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 +1641 -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 +357 -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 +788 -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 +314 -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 +291 -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 +580 -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 +2587 -0
- package/dist/api/compiler/checker-heritage.d.ts +28 -0
- package/dist/api/compiler/checker-heritage.js +901 -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 +442 -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 +200 -0
- package/dist/api/compiler/checker-members.js +2148 -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 +483 -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 +271 -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 +789 -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 +51 -0
- package/dist/api/compiler/checker-symbol-types.js +955 -0
- package/dist/api/compiler/checker-symbols.d.ts +181 -0
- package/dist/api/compiler/checker-symbols.js +1784 -0
- package/dist/api/compiler/checker-type-factory.d.ts +142 -0
- package/dist/api/compiler/checker-type-factory.js +2542 -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 +1093 -0
- package/dist/api/compiler/checker-types.js +1874 -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 +512 -0
- package/dist/api/compiler/checker.js +932 -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 +161 -0
- package/dist/api/compiler/diagnostics.js +784 -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 +144 -0
- package/dist/api/compiler/file-include.js +599 -0
- package/dist/api/compiler/file-loader.d.ts +290 -0
- package/dist/api/compiler/file-loader.js +1323 -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 +835 -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 +105 -0
- package/dist/api/compiler/link-tables.js +319 -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 +745 -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 +221 -0
- package/dist/api/compiler/parallel-parse.js +541 -0
- package/dist/api/compiler/parser.d.ts +604 -0
- package/dist/api/compiler/parser.js +6426 -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 +157 -0
- package/dist/api/compiler/printer/emit-context.js +582 -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 +529 -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 +1019 -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 +991 -0
- package/dist/api/compiler/symbol.d.ts +282 -0
- package/dist/api/compiler/symbol.js +339 -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 +677 -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 +539 -0
- package/dist/api/compiler/transformers/declarations-pseudo.d.ts +160 -0
- package/dist/api/compiler/transformers/declarations-pseudo.js +799 -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 +198 -0
- package/dist/api/compiler/transformers/declarations.d.ts +175 -0
- package/dist/api/compiler/transformers/declarations.js +2381 -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 +129 -0
- package/dist/api/compiler/transformers/reference-resolver.js +1157 -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 +10 -0
- package/dist/api/compiler/transformers/subtree-facts.js +205 -0
- package/dist/api/compiler/transformers/syntax-facts.d.ts +52 -0
- package/dist/api/compiler/transformers/syntax-facts.js +258 -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 +3 -2
- package/dist/api/library/ast.generated.d.ts +127 -139
- package/dist/api/library/checker.d.ts +51 -0
- package/dist/api/library/checker.js +318 -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/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 +5 -1
- package/dist/api/library/index.js +4 -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/types.d.ts +14 -1
- package/package.json +12 -8
- package/src/compiler/ast-utilities.ts +548 -0
- package/src/compiler/ast.ts +12870 -0
- package/src/compiler/astnav.ts +799 -0
- package/src/compiler/binder-utilities.ts +1392 -0
- package/src/compiler/binder.ts +2707 -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 +1201 -0
- package/src/compiler/checker-declared-types.ts +919 -0
- package/src/compiler/checker-decorators.ts +694 -0
- package/src/compiler/checker-deprecation.ts +355 -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 +3596 -0
- package/src/compiler/checker-heritage.ts +1240 -0
- package/src/compiler/checker-inference.ts +2584 -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 +1928 -0
- package/src/compiler/checker-literals.ts +61 -0
- package/src/compiler/checker-members.ts +2480 -0
- package/src/compiler/checker-modules.ts +2896 -0
- package/src/compiler/checker-narrowing.ts +3230 -0
- package/src/compiler/checker-object-literals.ts +591 -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 +1187 -0
- package/src/compiler/checker-symbols.ts +2157 -0
- package/src/compiler/checker-type-factory.ts +2616 -0
- package/src/compiler/checker-type-nodes.ts +1033 -0
- package/src/compiler/checker-type-operators.ts +2510 -0
- package/src/compiler/checker-types.ts +2520 -0
- package/src/compiler/checker-unused.ts +642 -0
- package/src/compiler/checker-utilities.ts +161 -0
- package/src/compiler/checker.ts +1138 -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 +858 -0
- package/src/compiler/emitter.ts +434 -0
- package/src/compiler/encoder.ts +1945 -0
- package/src/compiler/file-include.ts +741 -0
- package/src/compiler/file-loader.ts +1597 -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 +2818 -0
- package/src/compiler/init.ts +141 -0
- package/src/compiler/instantiation.ts +938 -0
- package/src/compiler/jsdoc.ts +1386 -0
- package/src/compiler/link-tables.ts +343 -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 +1071 -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 +3433 -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 +1954 -0
- package/src/compiler/parallel-parse.ts +595 -0
- package/src/compiler/parse-thread.ts +136 -0
- package/src/compiler/parser.ts +7766 -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 +684 -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 +594 -0
- package/src/compiler/program-utilities.ts +435 -0
- package/src/compiler/program.ts +1426 -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 +1166 -0
- package/src/compiler/symbol.ts +557 -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 +833 -0
- package/src/compiler/transformers/declarations-pseudo.ts +969 -0
- package/src/compiler/transformers/declarations-resolver.ts +249 -0
- package/src/compiler/transformers/declarations-syntactic.ts +1867 -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 +1213 -0
- package/src/compiler/transformers/runtime-syntax.ts +942 -0
- package/src/compiler/transformers/subtree-facts.ts +253 -0
- package/src/compiler/transformers/syntax-facts.ts +358 -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 +1422 -0
- package/src/compiler/tsc-cli.ts +669 -0
- package/src/compiler/tsc-compile.ts +446 -0
- package/src/compiler/tsc-watch.ts +922 -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 +141 -167
- package/src/library/ast.ts +4 -1
- package/src/library/checker.ts +384 -0
- package/src/library/diagnostics.ts +72 -0
- package/src/library/disk.ts +73 -0
- package/src/library/errors.ts +26 -0
- package/src/library/host.ts +63 -0
- package/src/library/index.ts +21 -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/types.ts +14 -1
|
@@ -0,0 +1,932 @@
|
|
|
1
|
+
import { sideOf } from './side-state.js';
|
|
2
|
+
import { CompactSymbolLinkTable, IntLinkTable, LinkTable, SparseLinkTable } from './link-tables.js';
|
|
3
|
+
import { getErrorRangeForNode, getSourceFileOfNode } from './binder-utilities.js';
|
|
4
|
+
import { Diagnostic, compareDiagnostics } from './diagnostics.js';
|
|
5
|
+
import { ModuleKind, ScriptTarget, getEmitScriptTarget, getIsolatedModules, getStrictOptionValue, shouldPreserveConstEnums, } from './options.js';
|
|
6
|
+
import { Symbol, getSymbolId } from './symbol.js';
|
|
7
|
+
import { IndexInfo, IntrinsicType, LiteralType, NodeLinks, Signature, SymbolLinks, TypeParameter, TypePredicate, emptyTypes, TypeListCache, TypeListTable, } from './checker-types.js';
|
|
8
|
+
import { getBaseTypes } from './checker-declared-types.js';
|
|
9
|
+
import { getFalseTypeFromConditionalType, getTrueTypeFromConditionalType } from './checker-type-operators.js';
|
|
10
|
+
import { createArrayType, createTypeFromGenericGlobalType, getBigIntLiteralType, getNumberLiteralType, getStringLiteralType, getTemplateLiteralType, getUnionType, newAnonymousType, newObjectType, } from './checker-type-factory.js';
|
|
11
|
+
import { CheckerNameResolver, borrowLibGlobals, findLibGlobals, returnLibGlobals, setGlobal, SuggestionNameResolver, getGlobalStrictFunctionType, getGlobalType, initializeGlobals, mergeAmbientModulesAndAugmentations, } from './checker-symbols.js';
|
|
12
|
+
import { PermissiveMapper, ReportingMapper, RestrictiveMapper, UniqueLiteralMapper } from './instantiation.js';
|
|
13
|
+
import { Relation, RelationKey } from './relations.js';
|
|
14
|
+
import { TypeNodeVisitor, checkSourceFile } from './checker-source-file.js';
|
|
15
|
+
import { InferenceCaches } from './checker-inference.js';
|
|
16
|
+
import { AssignmentMarker } from './checker-narrowing.js';
|
|
17
|
+
import { JsxState } from './checker-jsx.js';
|
|
18
|
+
import { SourceFileMetadata, getEmitModuleFormatOfFile } from './program-utilities.js';
|
|
19
|
+
/** What the checker needs from a program. */
|
|
20
|
+
export class CheckerHost {
|
|
21
|
+
/** How a module name in `file` resolved in `mode`, if the program resolved it. */
|
|
22
|
+
getResolvedModule(_file, _moduleName, _mode) {
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
/** The program file for a resolved file name, following project reference redirects. */
|
|
26
|
+
getSourceFileForResolvedModule(_fileName) {
|
|
27
|
+
return undefined;
|
|
28
|
+
}
|
|
29
|
+
/** The resolution mode of the module specifier `location` in `file`. */
|
|
30
|
+
getModeForUsageLocation(_file, _location) {
|
|
31
|
+
return ModuleKind.None;
|
|
32
|
+
}
|
|
33
|
+
/** The resolution mode of module names in `file` without a specifier of their own. */
|
|
34
|
+
getDefaultResolutionModeForFile(_file) {
|
|
35
|
+
return ModuleKind.None;
|
|
36
|
+
}
|
|
37
|
+
/** Packages that modules resolved into, by name: whether any of their resolutions was a declaration file. */
|
|
38
|
+
getPackagesMap() {
|
|
39
|
+
return new Map();
|
|
40
|
+
}
|
|
41
|
+
/** The declaration output of a referenced project's source file, or `''`. */
|
|
42
|
+
getProjectReferenceOutputDts(_fileName) {
|
|
43
|
+
return '';
|
|
44
|
+
}
|
|
45
|
+
fileExists(_path) {
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
/** The synthetic specifier of a file's implicit JSX runtime import, such as `react/jsx-runtime`, if any. */
|
|
49
|
+
/** The `tslib` import the program adds to `file` under --importHelpers. */
|
|
50
|
+
getImportHelpersImportSpecifier(_file) {
|
|
51
|
+
return undefined;
|
|
52
|
+
}
|
|
53
|
+
getJSXRuntimeImportSpecifier(_file) {
|
|
54
|
+
return undefined;
|
|
55
|
+
}
|
|
56
|
+
/** The globals and module augmentations of the program, if a checker merged them for the others. */
|
|
57
|
+
getMergedGlobals() {
|
|
58
|
+
return undefined;
|
|
59
|
+
}
|
|
60
|
+
/** The format `file` is emitted in when it differs from `module`, else `None`. */
|
|
61
|
+
getImpliedNodeFormatForEmit(_file) {
|
|
62
|
+
return ModuleKind.None;
|
|
63
|
+
}
|
|
64
|
+
/** The module syntax (`ESNext` or `CommonJS`) of the import or export with module specifier `usage`. */
|
|
65
|
+
getEmitSyntaxForUsageLocation(_file, _usage) {
|
|
66
|
+
return ModuleKind.None;
|
|
67
|
+
}
|
|
68
|
+
/** The `package.json` scope and implied module format of a file, if known. */
|
|
69
|
+
getSourceFileMetadata(_file) {
|
|
70
|
+
return undefined;
|
|
71
|
+
}
|
|
72
|
+
/** The module format `file` is emitted in. */
|
|
73
|
+
getEmitModuleFormatOfFile(file) {
|
|
74
|
+
return getEmitModuleFormatOfFile(file.fileName, this.getCompilerOptions(), this.getSourceFileMetadata(file) ?? new SourceFileMetadata('', '', ModuleKind.None));
|
|
75
|
+
}
|
|
76
|
+
/** What module specifier generation needs; without it, specifiers are relative paths. */
|
|
77
|
+
getModuleSpecifierHost() {
|
|
78
|
+
return undefined;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
/** Per-file and global diagnostics, sorted on read like tsgo's DiagnosticsCollection. */
|
|
82
|
+
class DiagnosticCollection {
|
|
83
|
+
byFile = new Map();
|
|
84
|
+
sortedFiles = new Set();
|
|
85
|
+
global = [];
|
|
86
|
+
globalSorted = true;
|
|
87
|
+
/** The diagnostics added since `startLog`, while recording. */
|
|
88
|
+
log = undefined;
|
|
89
|
+
add(diagnostic) {
|
|
90
|
+
if (this.log !== undefined)
|
|
91
|
+
this.log.push(diagnostic);
|
|
92
|
+
const file = diagnostic.file;
|
|
93
|
+
if (file === undefined) {
|
|
94
|
+
this.global.push(diagnostic);
|
|
95
|
+
this.globalSorted = false;
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
let list = this.byFile.get(file.fileName);
|
|
99
|
+
if (list === undefined) {
|
|
100
|
+
list = [];
|
|
101
|
+
this.byFile.set(file.fileName, list);
|
|
102
|
+
}
|
|
103
|
+
list.push(diagnostic);
|
|
104
|
+
this.sortedFiles.delete(file.fileName);
|
|
105
|
+
}
|
|
106
|
+
forFile(fileName) {
|
|
107
|
+
const list = this.byFile.get(fileName);
|
|
108
|
+
if (list === undefined)
|
|
109
|
+
return [];
|
|
110
|
+
if (!this.sortedFiles.has(fileName)) {
|
|
111
|
+
stableSort(list);
|
|
112
|
+
this.sortedFiles.add(fileName);
|
|
113
|
+
}
|
|
114
|
+
return list.slice();
|
|
115
|
+
}
|
|
116
|
+
count() {
|
|
117
|
+
let count = this.global.length;
|
|
118
|
+
for (const list of this.byFile.values())
|
|
119
|
+
count += list.length;
|
|
120
|
+
return count;
|
|
121
|
+
}
|
|
122
|
+
/** An already reported diagnostic equal to `diagnostic`, if any. */
|
|
123
|
+
lookup(diagnostic) {
|
|
124
|
+
const file = diagnostic.file;
|
|
125
|
+
const list = file === undefined ? this.global : this.byFile.get(file.fileName);
|
|
126
|
+
if (list === undefined)
|
|
127
|
+
return undefined;
|
|
128
|
+
for (const d of list)
|
|
129
|
+
if (compareDiagnostics(d, diagnostic) === 0)
|
|
130
|
+
return d;
|
|
131
|
+
return undefined;
|
|
132
|
+
}
|
|
133
|
+
globals() {
|
|
134
|
+
if (!this.globalSorted) {
|
|
135
|
+
stableSort(this.global);
|
|
136
|
+
this.globalSorted = true;
|
|
137
|
+
}
|
|
138
|
+
return this.global.slice();
|
|
139
|
+
}
|
|
140
|
+
/** Records the diagnostics added from now on. */
|
|
141
|
+
startLog() {
|
|
142
|
+
this.log = [];
|
|
143
|
+
}
|
|
144
|
+
/** The diagnostics added since `startLog`, in order; stops recording. */
|
|
145
|
+
takeLog() {
|
|
146
|
+
const log = this.log;
|
|
147
|
+
this.log = undefined;
|
|
148
|
+
return log;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
function stableSort(list) {
|
|
152
|
+
// Array.prototype.sort is stable.
|
|
153
|
+
list.sort(compareDiagnostics);
|
|
154
|
+
}
|
|
155
|
+
/** Maximum depth of nested `typeToString` calls before diagnostics are discarded. */
|
|
156
|
+
export const maxSerializationLevel = 2;
|
|
157
|
+
/**
|
|
158
|
+
* File positions per symbol id in `ExternalModuleContainerIndex.keys`. Symbol ids are int32, so the
|
|
159
|
+
* keys stay exact.
|
|
160
|
+
*/
|
|
161
|
+
export const fileIndexScale = 2 ** 21;
|
|
162
|
+
/** The modules that export each symbol, built once from every module's exports. */
|
|
163
|
+
export class ExternalModuleContainerIndex {
|
|
164
|
+
complete = false;
|
|
165
|
+
/**
|
|
166
|
+
* One key per symbol and module that exports it, ascending: the id of the symbol the export
|
|
167
|
+
* resolves to times `fileIndexScale`, plus the module's file position in `Checker.files`. The
|
|
168
|
+
* keys of one symbol are contiguous and in program order.
|
|
169
|
+
*/
|
|
170
|
+
keys = [];
|
|
171
|
+
}
|
|
172
|
+
/** The checker's caches for symbol accessibility. */
|
|
173
|
+
export class SymbolAccessibilityCaches {
|
|
174
|
+
/** Accessible chains by symbol id, then by `chainCacheKey`. */
|
|
175
|
+
accessibleChains = new Map();
|
|
176
|
+
/** Alias symbols of large tables (globals and exports), by table id. */
|
|
177
|
+
tableAliases = new Map();
|
|
178
|
+
/** Modules imported by a file that export a symbol, by symbol id then file node id. */
|
|
179
|
+
containersByFile = new Map();
|
|
180
|
+
/** All modules that export a symbol, by symbol id. */
|
|
181
|
+
containers = new Map();
|
|
182
|
+
/** The modules each symbol is exported from, built on the first search of all modules. */
|
|
183
|
+
externalModuleContainers = undefined;
|
|
184
|
+
/** The name tables of named class expressions, by node id. */
|
|
185
|
+
classExpressionNames = new Map();
|
|
186
|
+
/** Computed declaration visibility by node id (see isDeclarationVisible), 0 if not computed. */
|
|
187
|
+
declarationVisibility = new IntLinkTable();
|
|
188
|
+
/** The checker slots (bit `slot + 1`) whose declaration emit marked a node visible, by node id. */
|
|
189
|
+
markedSlots = new IntLinkTable();
|
|
190
|
+
/** The checker slot of the file in declaration emit, -1 before declaration emit. */
|
|
191
|
+
markedSlot = -1;
|
|
192
|
+
/** Counts the times declaration emit left a checker slot. */
|
|
193
|
+
visibilityEpoch = 0;
|
|
194
|
+
/** The epoch at which each slot (index `slot + 1`) was last left. */
|
|
195
|
+
slotsLeftAt = [0, 0, 0, 0, 0];
|
|
196
|
+
}
|
|
197
|
+
export class Checker {
|
|
198
|
+
host;
|
|
199
|
+
compilerOptions;
|
|
200
|
+
files;
|
|
201
|
+
fileIndex;
|
|
202
|
+
languageVersion;
|
|
203
|
+
strictNullChecks;
|
|
204
|
+
strictFunctionTypes;
|
|
205
|
+
strictBindCallApply;
|
|
206
|
+
strictPropertyInitialization;
|
|
207
|
+
strictBuiltinIteratorReturn;
|
|
208
|
+
noImplicitAny;
|
|
209
|
+
noImplicitThis;
|
|
210
|
+
legacyDecorators;
|
|
211
|
+
useUnknownInCatchVariables;
|
|
212
|
+
exactOptionalPropertyTypes;
|
|
213
|
+
isolatedModules;
|
|
214
|
+
preserveConstEnums;
|
|
215
|
+
noUncheckedIndexedAccess;
|
|
216
|
+
// Counters for type and signature ids.
|
|
217
|
+
typeCount = 0;
|
|
218
|
+
signatureCount = 0;
|
|
219
|
+
/** Positions of members by name in the tables and lists that lazily instantiated members come from. */
|
|
220
|
+
memberPositionsInLists = new Map();
|
|
221
|
+
/** The property names of the last instantiation of each such list whose table is built on demand. */
|
|
222
|
+
memberNamesOfLists = new Map();
|
|
223
|
+
/** Long lists of inherited properties, by name. */
|
|
224
|
+
propertiesByName = new Map();
|
|
225
|
+
/** Number of `typeToString` calls in progress. */
|
|
226
|
+
serializationLevel = 0;
|
|
227
|
+
/** Whether `globalObjectType` is set; global type lookups before it can't suggest `typeof`. */
|
|
228
|
+
hasGlobalObjectType = false;
|
|
229
|
+
/** The node being checked, for errors with no better location. */
|
|
230
|
+
currentNode = undefined;
|
|
231
|
+
diagnostics = new DiagnosticCollection();
|
|
232
|
+
suggestionDiagnostics = new DiagnosticCollection();
|
|
233
|
+
/** Module specifiers of `import("…")` types, by module symbol id, importing file path and resolution mode. */
|
|
234
|
+
moduleSpecifiers = new Map();
|
|
235
|
+
/** Specifier generation for hosts without a program. */
|
|
236
|
+
fallbackModuleSpecifierHost = undefined;
|
|
237
|
+
// Links of symbols and nodes by symbol and node id (see link-tables.ts). Values that many symbols
|
|
238
|
+
// or nodes have are columns of their own; the rest share one links object per symbol or node,
|
|
239
|
+
// created on first use.
|
|
240
|
+
symbolLinkTable = new SparseLinkTable();
|
|
241
|
+
nodeLinkTable = new SparseLinkTable();
|
|
242
|
+
/** The holders of the lazily computed state of types with side state (`sideOf`), by type id. */
|
|
243
|
+
sideHolders = new LinkTable();
|
|
244
|
+
/** The same for signatures with side state (`signatureSideOf`), by signature id. */
|
|
245
|
+
signatureSideHolders = new LinkTable();
|
|
246
|
+
/** The type of a value symbol. */
|
|
247
|
+
symbolTypes = new LinkTable();
|
|
248
|
+
/** For instantiated and synthetic symbols, the symbol they come from. */
|
|
249
|
+
symbolTargets = new LinkTable();
|
|
250
|
+
/** The mapper of an instantiated symbol or a mapped type property. */
|
|
251
|
+
symbolMappers = new LinkTable();
|
|
252
|
+
/** The literal type of a property name. */
|
|
253
|
+
symbolNameTypes = new LinkTable();
|
|
254
|
+
/** The mapped type of a mapped type property, or the union/intersection of a synthetic property. */
|
|
255
|
+
symbolContainingTypes = new LinkTable();
|
|
256
|
+
/** The key type of a mapped type property. */
|
|
257
|
+
symbolKeyTypes = new LinkTable();
|
|
258
|
+
/** The property a mapped, spread or synthetic property comes from. */
|
|
259
|
+
symbolSyntheticOrigins = new LinkTable();
|
|
260
|
+
/** The left and right properties a spread property combines. */
|
|
261
|
+
symbolLeftSpreads = new LinkTable();
|
|
262
|
+
symbolRightSpreads = new LinkTable();
|
|
263
|
+
/** Bits of SymbolFlags for the meanings in which a symbol was referenced. */
|
|
264
|
+
symbolReferenceKinds = new IntLinkTable();
|
|
265
|
+
/** The resolved symbol of an identifier, entity name or call. */
|
|
266
|
+
resolvedSymbols = new CompactSymbolLinkTable();
|
|
267
|
+
/** The resolved type of a type node or expression. */
|
|
268
|
+
resolvedTypes = new SparseLinkTable();
|
|
269
|
+
/** The resolved signature of a call-like node or a signature declaration. */
|
|
270
|
+
resolvedSignatures = new SparseLinkTable();
|
|
271
|
+
/** Merged symbols, indexed by the id of the symbol merged into them. */
|
|
272
|
+
mergedSymbols;
|
|
273
|
+
/** Globals merged from the default libraries, shared with other checkers. */
|
|
274
|
+
libGlobals;
|
|
275
|
+
/** The program's globals and module augmentations as another checker merged them, shared with it. */
|
|
276
|
+
mergedGlobals;
|
|
277
|
+
/**
|
|
278
|
+
* The diagnostics and suggestions the merges reported: those of the globals, then those of the
|
|
279
|
+
* ambient modules and module augmentations.
|
|
280
|
+
*/
|
|
281
|
+
mergeDiagnostics = [];
|
|
282
|
+
/**
|
|
283
|
+
* This checker's changes to `globals` and `mergedSymbols` when it uses the tables of
|
|
284
|
+
* `libGlobals` in place rather than copies; they are undone when it is disposed.
|
|
285
|
+
*/
|
|
286
|
+
globalChanges = undefined;
|
|
287
|
+
mergedSymbolChanges = undefined;
|
|
288
|
+
/** This checker's copies of shared symbols, and the symbols they stand for. */
|
|
289
|
+
sharedSymbolCopies = new Map();
|
|
290
|
+
/** Accessible symbol chains and declaration visibility, created on first use. */
|
|
291
|
+
symbolAccessibilityCaches = undefined;
|
|
292
|
+
// Symbols
|
|
293
|
+
globals;
|
|
294
|
+
resolver;
|
|
295
|
+
undefinedSymbol;
|
|
296
|
+
argumentsSymbol;
|
|
297
|
+
requireSymbol;
|
|
298
|
+
unknownSymbol;
|
|
299
|
+
globalThisSymbol;
|
|
300
|
+
unresolvedSymbols = new Map();
|
|
301
|
+
/** Widening's optional `undefined` properties by the id of the property each is created from. */
|
|
302
|
+
undefinedProperties = new Map();
|
|
303
|
+
// Interning tables.
|
|
304
|
+
stringLiteralTypes = new Map();
|
|
305
|
+
numberLiteralTypes = new Map();
|
|
306
|
+
bigintLiteralTypes = new Map();
|
|
307
|
+
enumLiteralTypes = new Map();
|
|
308
|
+
uniqueESSymbolTypes = new Map();
|
|
309
|
+
/** Unions by a hash of their key; `unionTypes` holds the unions whose key hash was taken. */
|
|
310
|
+
unionTypesByHash = new Map();
|
|
311
|
+
unionTypes = new Map();
|
|
312
|
+
unionOfUnionTypes = new Map();
|
|
313
|
+
/** `unionOfUnionTypes` without an alias, by both ids and the reduction packed into one number. */
|
|
314
|
+
unionOfUnionTypesById = new Map();
|
|
315
|
+
intersectionTypes = new TypeListCache();
|
|
316
|
+
tupleTypes = new Map();
|
|
317
|
+
indexedAccessTypes = new Map();
|
|
318
|
+
templateLiteralTypes = new Map();
|
|
319
|
+
/** Instantiations of template literal types: the instantiated types, tagged with the template's id. */
|
|
320
|
+
templateLiteralInstantiations = new TypeListCache();
|
|
321
|
+
/** The type argument lists that references and instantiations keep, one of each (`TypeListTable`). */
|
|
322
|
+
typeLists = new TypeListTable();
|
|
323
|
+
stringMappingTypes = new Map();
|
|
324
|
+
substitutionTypes = new Map();
|
|
325
|
+
subtypeReductionCache = new TypeListCache();
|
|
326
|
+
cachedTypes = new Map();
|
|
327
|
+
/** Cached types by `cachedTypeKey` and by `cachedTypePairKey`, without spelled keys. */
|
|
328
|
+
cachedTypesById = new Map();
|
|
329
|
+
cachedTypesByPair = new Map();
|
|
330
|
+
errorTypes = new Map();
|
|
331
|
+
// Intrinsic types, created in tsgo's order so ids (the last-resort union order) match.
|
|
332
|
+
anyType;
|
|
333
|
+
autoType;
|
|
334
|
+
wildcardType;
|
|
335
|
+
blockedStringType;
|
|
336
|
+
errorType;
|
|
337
|
+
unresolvedType;
|
|
338
|
+
nonInferrableAnyType;
|
|
339
|
+
intrinsicMarkerType;
|
|
340
|
+
unknownType;
|
|
341
|
+
undefinedType;
|
|
342
|
+
undefinedWideningType;
|
|
343
|
+
missingType;
|
|
344
|
+
undefinedOrMissingType;
|
|
345
|
+
optionalType;
|
|
346
|
+
nullType;
|
|
347
|
+
nullWideningType;
|
|
348
|
+
stringType;
|
|
349
|
+
numberType;
|
|
350
|
+
bigintType;
|
|
351
|
+
regularFalseType;
|
|
352
|
+
falseType;
|
|
353
|
+
regularTrueType;
|
|
354
|
+
trueType;
|
|
355
|
+
booleanType;
|
|
356
|
+
esSymbolType;
|
|
357
|
+
voidType;
|
|
358
|
+
neverType;
|
|
359
|
+
silentNeverType;
|
|
360
|
+
implicitNeverType;
|
|
361
|
+
unreachableNeverType;
|
|
362
|
+
nonPrimitiveType;
|
|
363
|
+
stringOrNumberType;
|
|
364
|
+
stringNumberSymbolType;
|
|
365
|
+
numberOrBigIntType;
|
|
366
|
+
numericStringType;
|
|
367
|
+
templateConstraintType;
|
|
368
|
+
uniqueLiteralType;
|
|
369
|
+
emptyObjectType;
|
|
370
|
+
emptyJsxObjectType;
|
|
371
|
+
emptyFreshJsxObjectType;
|
|
372
|
+
emptyTypeLiteralType;
|
|
373
|
+
unknownEmptyObjectType;
|
|
374
|
+
unknownUnionType;
|
|
375
|
+
emptyGenericType;
|
|
376
|
+
anyFunctionType;
|
|
377
|
+
noConstraintType;
|
|
378
|
+
circularConstraintType;
|
|
379
|
+
resolvingDefaultType;
|
|
380
|
+
markerSuperType;
|
|
381
|
+
markerSubType;
|
|
382
|
+
markerOtherType;
|
|
383
|
+
markerSuperTypeForCheck;
|
|
384
|
+
markerSubTypeForCheck;
|
|
385
|
+
noTypePredicate;
|
|
386
|
+
anySignature;
|
|
387
|
+
unknownSignature;
|
|
388
|
+
resolvingSignature;
|
|
389
|
+
silentNeverSignature;
|
|
390
|
+
enumNumberIndexInfo;
|
|
391
|
+
anyBaseTypeIndexInfo;
|
|
392
|
+
emptyStringType;
|
|
393
|
+
zeroType;
|
|
394
|
+
zeroBigIntType;
|
|
395
|
+
typeofType;
|
|
396
|
+
// Mappers that observe the types they map.
|
|
397
|
+
reportUnreliableMapper;
|
|
398
|
+
reportUnmeasurableMapper;
|
|
399
|
+
restrictiveMapper;
|
|
400
|
+
permissiveMapper;
|
|
401
|
+
uniqueLiteralMapper;
|
|
402
|
+
/** Set by the reporting mappers during variance measurement. */
|
|
403
|
+
reliabilityFlags = 0;
|
|
404
|
+
// Relations
|
|
405
|
+
subtypeRelation = new Relation();
|
|
406
|
+
strictSubtypeRelation = new Relation();
|
|
407
|
+
assignableRelation = new Relation();
|
|
408
|
+
comparableRelation = new Relation();
|
|
409
|
+
identityRelation = new Relation();
|
|
410
|
+
enumRelation = new Map();
|
|
411
|
+
/** A relater that is not in use, kept so that relation checks don't allocate one each. */
|
|
412
|
+
spareRelater = undefined;
|
|
413
|
+
// Global types, set by `initializeChecker`.
|
|
414
|
+
globalArrayType;
|
|
415
|
+
globalObjectType;
|
|
416
|
+
globalFunctionType;
|
|
417
|
+
globalCallableFunctionType;
|
|
418
|
+
globalNewableFunctionType;
|
|
419
|
+
globalStringType;
|
|
420
|
+
globalNumberType;
|
|
421
|
+
globalBooleanType;
|
|
422
|
+
globalRegExpType;
|
|
423
|
+
anyArrayType;
|
|
424
|
+
autoArrayType;
|
|
425
|
+
globalReadonlyArrayType;
|
|
426
|
+
anyReadonlyArrayType;
|
|
427
|
+
globalThisType;
|
|
428
|
+
/** Lazily resolved global types and symbols, by name. */
|
|
429
|
+
globalTypeCache = new Map();
|
|
430
|
+
/** Module namespace types with synthetic defaults, by kind and type id. */
|
|
431
|
+
moduleTypeCache = new Map();
|
|
432
|
+
globalSymbolCache = new Map();
|
|
433
|
+
// Resolution stacks for cycle detection (see pushTypeResolution).
|
|
434
|
+
resolutionStart = 0;
|
|
435
|
+
inVarianceComputation = false;
|
|
436
|
+
// Instantiation
|
|
437
|
+
instantiationDepth = 0;
|
|
438
|
+
instantiationCount = 0;
|
|
439
|
+
/** Instantiations over the checker's lifetime (statistics). */
|
|
440
|
+
totalInstantiations = 0;
|
|
441
|
+
/** Mappers of the instantiations in progress: the first `activeMapperDepth` entries are live. */
|
|
442
|
+
activeMappers = [];
|
|
443
|
+
activeMapperDepth = 0;
|
|
444
|
+
/** Per active mapper: its instantiations by type id, created on the first nested write. */
|
|
445
|
+
activeMapperCaches = [];
|
|
446
|
+
/** Per active mapper: its instantiations with an alias, by type id and alias key. */
|
|
447
|
+
activeMapperAliasCaches = [];
|
|
448
|
+
/**
|
|
449
|
+
* Cleared caches of popped mappers, reused as tsgo's pushActiveMapper reuses the maps
|
|
450
|
+
* popActiveMapper clears: the first `freeMapperCacheCount` are free.
|
|
451
|
+
*/
|
|
452
|
+
freeMapperCaches = [];
|
|
453
|
+
freeMapperCacheCount = 0;
|
|
454
|
+
/** Empty lists for type arguments that are compared with cached instantiations before any is kept. */
|
|
455
|
+
freeTypeLists = [];
|
|
456
|
+
/**
|
|
457
|
+
* 1 by type id for the anonymous and mapped types whose declaration has no outer type parameters
|
|
458
|
+
* to instantiate (`getObjectTypeInstantiation`).
|
|
459
|
+
*/
|
|
460
|
+
withoutOuterTypeParameters = new IntLinkTable();
|
|
461
|
+
conditionalConstraintDepth = 0;
|
|
462
|
+
suggestionResolver;
|
|
463
|
+
awaitedTypeStack = [];
|
|
464
|
+
/** Iteration types by type id and iteration use. */
|
|
465
|
+
iterationTypesCache = new Map();
|
|
466
|
+
/** Whether diagnostics can be deferred to the end of the file being checked. */
|
|
467
|
+
saveDeferredDiagnostics = false;
|
|
468
|
+
deferredIterationErrors = [];
|
|
469
|
+
/** Collision checks waiting for the end of the file (checker-generated-code.ts). */
|
|
470
|
+
deferredCollisionChecks = [];
|
|
471
|
+
/** Binding patterns whose implied type is being computed as a contextual type. */
|
|
472
|
+
contextualBindingPatterns = [];
|
|
473
|
+
/** The binding pattern or assignment pattern that implied each type. */
|
|
474
|
+
patternForType = new Map();
|
|
475
|
+
/** Spread element indices of array literals with contextually typed elements. */
|
|
476
|
+
spreadIndices = new Map();
|
|
477
|
+
/** Instantiation expression types by node and expression type id. */
|
|
478
|
+
instantiationExpressionTypes = new Map();
|
|
479
|
+
relationComparers = [];
|
|
480
|
+
relationScratchKey = new RelationKey();
|
|
481
|
+
/** Numbers for relation keys that are spelled as strings (see getRelationKey). */
|
|
482
|
+
relationKeyIds = new Map();
|
|
483
|
+
/** Numbers for generic relation keys spelled as tokens, by a hash of the tokens. */
|
|
484
|
+
relationKeyTokens = new Map();
|
|
485
|
+
/** The number of interned relation keys of both kinds. */
|
|
486
|
+
relationKeyCount = 0;
|
|
487
|
+
markerTypes = new Set();
|
|
488
|
+
arrayVariances = [1 /* VarianceFlags.Covariant */];
|
|
489
|
+
nanLiteralType = undefined;
|
|
490
|
+
/** `{ meta: ImportMeta }`, the type of `import.meta` for symbol queries. */
|
|
491
|
+
importMetaExpressionType = undefined;
|
|
492
|
+
// Control flow analysis
|
|
493
|
+
flowAnalysisDisabled = false;
|
|
494
|
+
inlineLevel = 0;
|
|
495
|
+
/**
|
|
496
|
+
* Shared flow nodes cached by the walks in progress, with their types: the first
|
|
497
|
+
* `sharedFlowCount` entries are live, later slots are reused.
|
|
498
|
+
*/
|
|
499
|
+
sharedFlowNodes = [];
|
|
500
|
+
sharedFlowTypes = [];
|
|
501
|
+
sharedFlowIncomplete = [];
|
|
502
|
+
sharedFlowCount = 0;
|
|
503
|
+
/**
|
|
504
|
+
* For each walk in progress, by its depth (`flowStateDepth`), once it has cached
|
|
505
|
+
* `sharedFlowIndexThreshold` shared nodes: the index of each node's first entry in the cache above.
|
|
506
|
+
*/
|
|
507
|
+
sharedFlowIndexes = [];
|
|
508
|
+
/**
|
|
509
|
+
* Flow states, reused as in tsgo's getFlowState/putFlowState: the first `flowStateDepth` belong
|
|
510
|
+
* to walks in progress, the rest are free.
|
|
511
|
+
*/
|
|
512
|
+
flowStates = [];
|
|
513
|
+
flowStateDepth = 0;
|
|
514
|
+
flowLoopCaches = new Map();
|
|
515
|
+
/** The last long walk of each reference key outside loops: see `FlowWalk`. */
|
|
516
|
+
flowWalks = new Map();
|
|
517
|
+
flowLoopStack = [];
|
|
518
|
+
/** Types of expressions whose computation needed flow analysis, outside loop back edges. */
|
|
519
|
+
flowTypeCache = undefined;
|
|
520
|
+
flowInvocationCount = 0;
|
|
521
|
+
/** The reduce labels being passed, innermost last; each limits its target label's antecedents. */
|
|
522
|
+
flowReduceLabels = [];
|
|
523
|
+
flowNodeReachable = new Map();
|
|
524
|
+
flowNodePostSuper = new Map();
|
|
525
|
+
lastFlowNode = undefined;
|
|
526
|
+
lastFlowNodeReachable = false;
|
|
527
|
+
assignmentMarker;
|
|
528
|
+
primitiveTypeAliasSuggestions = new Map();
|
|
529
|
+
/** Renamed binding elements in parameters of bodiless signatures, checked for use with their file. */
|
|
530
|
+
renamedBindingElementsInTypes = [];
|
|
531
|
+
/** The type parameter whose variance annotation is being checked, to name its marker types. */
|
|
532
|
+
varianceTypeParameter = undefined;
|
|
533
|
+
/** Whether the statement being checked is unreachable, to report unreachable code once. */
|
|
534
|
+
withinUnreachableCode = false;
|
|
535
|
+
reportedUnreachableNodes = new Set();
|
|
536
|
+
/** The grammar checker of the file whose expressions are being checked. */
|
|
537
|
+
grammarChecker = undefined;
|
|
538
|
+
/** Nodes queued for a deferred check (checkNodeDeferred), each checked once. */
|
|
539
|
+
deferredNodeIds = new Set();
|
|
540
|
+
typeNodeVisitor;
|
|
541
|
+
jsx = new JsxState();
|
|
542
|
+
/** Per file: its tslib module and the emit helpers checked against it (checkExternalEmitHelpers). */
|
|
543
|
+
emitHelperFileLinks = new Map();
|
|
544
|
+
/** The file checkSourceFile is checking. */
|
|
545
|
+
fileBeingChecked = undefined;
|
|
546
|
+
// Ambient modules
|
|
547
|
+
ambientModuleSymbols = [];
|
|
548
|
+
patternAmbientModules = [];
|
|
549
|
+
patternAmbientModuleAugmentations = new Map();
|
|
550
|
+
inferenceCaches = new InferenceCaches();
|
|
551
|
+
/** The type resolution stack: the first `resolutionDepth` entries are live, later slots are reused. */
|
|
552
|
+
resolutionTargets = [];
|
|
553
|
+
resolutionResults = [];
|
|
554
|
+
resolutionPropertyNames = [];
|
|
555
|
+
resolutionDepth = 0;
|
|
556
|
+
/** The number of resolution cycles found (`pushTypeResolution`). */
|
|
557
|
+
resolutionCycleCount = 0;
|
|
558
|
+
constructor(host) {
|
|
559
|
+
this.host = host;
|
|
560
|
+
const options = host.getCompilerOptions();
|
|
561
|
+
this.compilerOptions = options;
|
|
562
|
+
this.files = host.getSourceFiles();
|
|
563
|
+
this.fileIndex = new Map();
|
|
564
|
+
for (let i = 0; i < this.files.length; i++)
|
|
565
|
+
this.fileIndex.set(this.files[i], i);
|
|
566
|
+
this.languageVersion = getEmitScriptTarget(options);
|
|
567
|
+
this.strictNullChecks = getStrictOptionValue(options, options.strictNullChecks);
|
|
568
|
+
this.strictFunctionTypes = getStrictOptionValue(options, options.strictFunctionTypes);
|
|
569
|
+
this.strictBindCallApply = getStrictOptionValue(options, options.strictBindCallApply);
|
|
570
|
+
this.strictPropertyInitialization = getStrictOptionValue(options, options.strictPropertyInitialization);
|
|
571
|
+
this.strictBuiltinIteratorReturn = getStrictOptionValue(options, options.strictBuiltinIteratorReturn);
|
|
572
|
+
this.noImplicitAny = getStrictOptionValue(options, options.noImplicitAny);
|
|
573
|
+
this.noImplicitThis = getStrictOptionValue(options, options.noImplicitThis);
|
|
574
|
+
this.legacyDecorators = options.experimentalDecorators === true;
|
|
575
|
+
this.useUnknownInCatchVariables = getStrictOptionValue(options, options.useUnknownInCatchVariables);
|
|
576
|
+
this.exactOptionalPropertyTypes = options.exactOptionalPropertyTypes === true;
|
|
577
|
+
this.isolatedModules = getIsolatedModules(options);
|
|
578
|
+
this.preserveConstEnums = shouldPreserveConstEnums(options);
|
|
579
|
+
this.noUncheckedIndexedAccess = options.noUncheckedIndexedAccess === true;
|
|
580
|
+
this.undefinedSymbol = this.newSymbol(4 /* SymbolFlags.Property */, 'undefined');
|
|
581
|
+
this.argumentsSymbol = this.newSymbol(4 /* SymbolFlags.Property */, 'arguments');
|
|
582
|
+
this.requireSymbol = this.newSymbol(4 /* SymbolFlags.Property */, 'require');
|
|
583
|
+
this.unknownSymbol = this.newSymbol(4 /* SymbolFlags.Property */, 'unknown');
|
|
584
|
+
const merged = host.getMergedGlobals();
|
|
585
|
+
this.mergedGlobals = merged;
|
|
586
|
+
const libs = merged === undefined ? findLibGlobals(this) : undefined;
|
|
587
|
+
this.libGlobals = libs;
|
|
588
|
+
if (merged !== undefined) {
|
|
589
|
+
this.globals = new Map(merged.globals);
|
|
590
|
+
this.mergedSymbols = new Map(merged.mergedSymbols);
|
|
591
|
+
}
|
|
592
|
+
else if (libs === undefined) {
|
|
593
|
+
this.globals = new Map();
|
|
594
|
+
this.mergedSymbols = new Map();
|
|
595
|
+
}
|
|
596
|
+
else if (libs.borrower === undefined) {
|
|
597
|
+
borrowLibGlobals(this, libs);
|
|
598
|
+
this.globals = libs.globals;
|
|
599
|
+
this.mergedSymbols = libs.mergedSymbols;
|
|
600
|
+
}
|
|
601
|
+
else {
|
|
602
|
+
this.globals = libs.copyGlobals();
|
|
603
|
+
this.mergedSymbols = libs.copyMergedSymbols();
|
|
604
|
+
}
|
|
605
|
+
this.globalThisSymbol = this.newSymbol(1536 /* SymbolFlags.Module */, 'globalThis');
|
|
606
|
+
this.globalThisSymbol.checkFlags = 8 /* CheckFlags.Readonly */;
|
|
607
|
+
this.globalThisSymbol.exports = this.globals;
|
|
608
|
+
setGlobal(this, this.globalThisSymbol.name, this.globalThisSymbol);
|
|
609
|
+
this.resolver = new CheckerNameResolver(this);
|
|
610
|
+
this.suggestionResolver = new SuggestionNameResolver(this);
|
|
611
|
+
this.typeNodeVisitor = new TypeNodeVisitor(this);
|
|
612
|
+
this.assignmentMarker = new AssignmentMarker(this);
|
|
613
|
+
this.anyType = this.newIntrinsicType(1 /* TypeFlags.Any */, 'any', 0 /* ObjectFlags.None */);
|
|
614
|
+
this.autoType = this.newIntrinsicType(1 /* TypeFlags.Any */, 'any', 262144 /* ObjectFlags.NonInferrableType */);
|
|
615
|
+
this.wildcardType = this.newIntrinsicType(1 /* TypeFlags.Any */, 'any', 0 /* ObjectFlags.None */);
|
|
616
|
+
this.blockedStringType = this.newIntrinsicType(1 /* TypeFlags.Any */, 'any', 0 /* ObjectFlags.None */);
|
|
617
|
+
this.errorType = this.newIntrinsicType(1 /* TypeFlags.Any */, 'error', 0 /* ObjectFlags.None */);
|
|
618
|
+
this.unresolvedType = this.newIntrinsicType(1 /* TypeFlags.Any */, 'unresolved', 0 /* ObjectFlags.None */);
|
|
619
|
+
this.nonInferrableAnyType = this.newIntrinsicType(1 /* TypeFlags.Any */, 'any', 65536 /* ObjectFlags.ContainsWideningType */);
|
|
620
|
+
this.intrinsicMarkerType = this.newIntrinsicType(1 /* TypeFlags.Any */, 'intrinsic', 0 /* ObjectFlags.None */);
|
|
621
|
+
this.unknownType = this.newIntrinsicType(2 /* TypeFlags.Unknown */, 'unknown', 0 /* ObjectFlags.None */);
|
|
622
|
+
this.undefinedType = this.newIntrinsicType(4 /* TypeFlags.Undefined */, 'undefined', 0 /* ObjectFlags.None */);
|
|
623
|
+
this.undefinedWideningType = this.strictNullChecks
|
|
624
|
+
? this.undefinedType
|
|
625
|
+
: this.newIntrinsicType(4 /* TypeFlags.Undefined */, 'undefined', 65536 /* ObjectFlags.ContainsWideningType */);
|
|
626
|
+
this.missingType = this.newIntrinsicType(4 /* TypeFlags.Undefined */, 'undefined', 0 /* ObjectFlags.None */);
|
|
627
|
+
this.undefinedOrMissingType = this.exactOptionalPropertyTypes ? this.missingType : this.undefinedType;
|
|
628
|
+
this.optionalType = this.newIntrinsicType(4 /* TypeFlags.Undefined */, 'undefined', 0 /* ObjectFlags.None */);
|
|
629
|
+
this.nullType = this.newIntrinsicType(8 /* TypeFlags.Null */, 'null', 0 /* ObjectFlags.None */);
|
|
630
|
+
this.nullWideningType = this.strictNullChecks
|
|
631
|
+
? this.nullType
|
|
632
|
+
: this.newIntrinsicType(8 /* TypeFlags.Null */, 'null', 65536 /* ObjectFlags.ContainsWideningType */);
|
|
633
|
+
this.stringType = this.newIntrinsicType(32 /* TypeFlags.String */, 'string', 0 /* ObjectFlags.None */);
|
|
634
|
+
this.numberType = this.newIntrinsicType(64 /* TypeFlags.Number */, 'number', 0 /* ObjectFlags.None */);
|
|
635
|
+
this.bigintType = this.newIntrinsicType(128 /* TypeFlags.BigInt */, 'bigint', 0 /* ObjectFlags.None */);
|
|
636
|
+
this.regularFalseType = this.newLiteralType(8192 /* TypeFlags.BooleanLiteral */, 'false', 0, undefined);
|
|
637
|
+
this.falseType = this.newLiteralType(8192 /* TypeFlags.BooleanLiteral */, 'false', 0, undefined);
|
|
638
|
+
this.falseType.regularType = this.regularFalseType;
|
|
639
|
+
this.regularFalseType.freshType = this.falseType;
|
|
640
|
+
this.falseType.freshType = this.falseType;
|
|
641
|
+
this.regularTrueType = this.newLiteralType(8192 /* TypeFlags.BooleanLiteral */, 'true', 0, undefined);
|
|
642
|
+
this.trueType = this.newLiteralType(8192 /* TypeFlags.BooleanLiteral */, 'true', 0, undefined);
|
|
643
|
+
this.trueType.regularType = this.regularTrueType;
|
|
644
|
+
this.regularTrueType.freshType = this.trueType;
|
|
645
|
+
this.trueType.freshType = this.trueType;
|
|
646
|
+
this.booleanType = getUnionType(this, [this.regularFalseType, this.regularTrueType]);
|
|
647
|
+
this.esSymbolType = this.newIntrinsicType(512 /* TypeFlags.ESSymbol */, 'symbol', 0 /* ObjectFlags.None */);
|
|
648
|
+
this.voidType = this.newIntrinsicType(16 /* TypeFlags.Void */, 'void', 0 /* ObjectFlags.None */);
|
|
649
|
+
this.neverType = this.newIntrinsicType(262144 /* TypeFlags.Never */, 'never', 0 /* ObjectFlags.None */);
|
|
650
|
+
this.silentNeverType = this.newIntrinsicType(262144 /* TypeFlags.Never */, 'never', 262144 /* ObjectFlags.NonInferrableType */);
|
|
651
|
+
this.implicitNeverType = this.newIntrinsicType(262144 /* TypeFlags.Never */, 'never', 0 /* ObjectFlags.None */);
|
|
652
|
+
this.unreachableNeverType = this.newIntrinsicType(262144 /* TypeFlags.Never */, 'never', 0 /* ObjectFlags.None */);
|
|
653
|
+
this.nonPrimitiveType = this.newIntrinsicType(131072 /* TypeFlags.NonPrimitive */, 'object', 0 /* ObjectFlags.None */);
|
|
654
|
+
this.stringOrNumberType = getUnionType(this, [this.stringType, this.numberType]);
|
|
655
|
+
this.stringNumberSymbolType = getUnionType(this, [this.stringType, this.numberType, this.esSymbolType]);
|
|
656
|
+
this.numberOrBigIntType = getUnionType(this, [this.numberType, this.bigintType]);
|
|
657
|
+
this.numericStringType = getTemplateLiteralType(this, ['', ''], [this.numberType]);
|
|
658
|
+
this.templateConstraintType = getUnionType(this, [
|
|
659
|
+
this.stringType,
|
|
660
|
+
this.numberType,
|
|
661
|
+
this.booleanType,
|
|
662
|
+
this.bigintType,
|
|
663
|
+
this.nullType,
|
|
664
|
+
this.undefinedType,
|
|
665
|
+
]);
|
|
666
|
+
this.uniqueLiteralType = this.newIntrinsicType(262144 /* TypeFlags.Never */, 'never', 0 /* ObjectFlags.None */);
|
|
667
|
+
this.reportUnreliableMapper = new ReportingMapper(this, 16 /* VarianceReporting.Unreliable */);
|
|
668
|
+
this.reportUnmeasurableMapper = new ReportingMapper(this, 8 /* VarianceReporting.Unmeasurable */);
|
|
669
|
+
this.restrictiveMapper = new RestrictiveMapper(this);
|
|
670
|
+
this.permissiveMapper = new PermissiveMapper(this);
|
|
671
|
+
this.uniqueLiteralMapper = new UniqueLiteralMapper(this);
|
|
672
|
+
this.emptyObjectType = newAnonymousType(this, undefined);
|
|
673
|
+
this.emptyJsxObjectType = newAnonymousType(this, undefined);
|
|
674
|
+
this.emptyFreshJsxObjectType = newAnonymousType(this, undefined);
|
|
675
|
+
this.emptyTypeLiteralType = newAnonymousType(this, this.newSymbol(2048 /* SymbolFlags.TypeLiteral */, 'type'));
|
|
676
|
+
this.unknownEmptyObjectType = newAnonymousType(this, undefined);
|
|
677
|
+
this.unknownUnionType = this.strictNullChecks
|
|
678
|
+
? getUnionType(this, [this.undefinedType, this.nullType, this.unknownEmptyObjectType])
|
|
679
|
+
: this.unknownType;
|
|
680
|
+
this.emptyGenericType = newAnonymousType(this, undefined);
|
|
681
|
+
sideOf(this, this.emptyGenericType).instantiations = new TypeListCache();
|
|
682
|
+
this.anyFunctionType = newAnonymousType(this, undefined);
|
|
683
|
+
this.anyFunctionType.objectFlags |= 262144 /* ObjectFlags.NonInferrableType */;
|
|
684
|
+
this.noConstraintType = newAnonymousType(this, undefined);
|
|
685
|
+
this.circularConstraintType = newAnonymousType(this, undefined);
|
|
686
|
+
this.resolvingDefaultType = newAnonymousType(this, undefined);
|
|
687
|
+
this.markerSuperType = this.newTypeParameter(undefined);
|
|
688
|
+
this.markerSubType = this.newTypeParameter(undefined);
|
|
689
|
+
this.markerSubType.constraint = this.markerSuperType;
|
|
690
|
+
this.markerOtherType = this.newTypeParameter(undefined);
|
|
691
|
+
this.markerSuperTypeForCheck = this.newTypeParameter(undefined);
|
|
692
|
+
this.markerSubTypeForCheck = this.newTypeParameter(undefined);
|
|
693
|
+
this.markerSubTypeForCheck.constraint = this.markerSuperTypeForCheck;
|
|
694
|
+
this.noTypePredicate = new TypePredicate(1 /* TypePredicateKind.Identifier */, '<<unresolved>>', 0, this.anyType);
|
|
695
|
+
this.anySignature = this.newSignature(0 /* SignatureFlags.None */, undefined, emptyTypes, undefined, [], this.anyType, 0);
|
|
696
|
+
this.unknownSignature = this.newSignature(0 /* SignatureFlags.None */, undefined, emptyTypes, undefined, [], this.errorType, 0);
|
|
697
|
+
this.resolvingSignature = this.newSignature(0 /* SignatureFlags.None */, undefined, emptyTypes, undefined, [], this.anyType, 0);
|
|
698
|
+
this.silentNeverSignature = this.newSignature(0 /* SignatureFlags.None */, undefined, emptyTypes, undefined, [], this.silentNeverType, 0);
|
|
699
|
+
this.enumNumberIndexInfo = new IndexInfo(this.numberType, this.stringType, true, undefined, []);
|
|
700
|
+
this.anyBaseTypeIndexInfo = new IndexInfo(this.stringType, this.anyType, false, undefined, []);
|
|
701
|
+
this.emptyStringType = getStringLiteralType(this, '');
|
|
702
|
+
this.zeroType = getNumberLiteralType(this, 0);
|
|
703
|
+
this.zeroBigIntType = getBigIntLiteralType(this, '0');
|
|
704
|
+
const typeofNames = ['bigint', 'boolean', 'function', 'number', 'object', 'string', 'symbol', 'undefined'];
|
|
705
|
+
const typeofTypes = [];
|
|
706
|
+
for (const name of typeofNames)
|
|
707
|
+
typeofTypes.push(getStringLiteralType(this, name));
|
|
708
|
+
this.typeofType = getUnionType(this, typeofTypes);
|
|
709
|
+
// initializeChecker
|
|
710
|
+
this.diagnostics.startLog();
|
|
711
|
+
this.suggestionDiagnostics.startLog();
|
|
712
|
+
initializeGlobals(this);
|
|
713
|
+
this.mergeDiagnostics.push(this.diagnostics.takeLog(), this.suggestionDiagnostics.takeLog());
|
|
714
|
+
this.symbolTypes.set(getSymbolId(this.undefinedSymbol), this.undefinedWideningType);
|
|
715
|
+
this.symbolTypes.set(getSymbolId(this.argumentsSymbol), getGlobalType(this, 'IArguments', 0, true));
|
|
716
|
+
this.symbolTypes.set(getSymbolId(this.unknownSymbol), this.errorType);
|
|
717
|
+
this.symbolTypes.set(getSymbolId(this.globalThisSymbol), newObjectType(this, 16 /* ObjectFlags.Anonymous */, this.globalThisSymbol));
|
|
718
|
+
this.globalArrayType = getGlobalType(this, 'Array', 1, true);
|
|
719
|
+
this.globalObjectType = getGlobalType(this, 'Object', 0, true);
|
|
720
|
+
this.hasGlobalObjectType = true;
|
|
721
|
+
this.globalFunctionType = getGlobalType(this, 'Function', 0, true);
|
|
722
|
+
this.globalCallableFunctionType = getGlobalStrictFunctionType(this, 'CallableFunction');
|
|
723
|
+
this.globalNewableFunctionType = getGlobalStrictFunctionType(this, 'NewableFunction');
|
|
724
|
+
this.globalStringType = getGlobalType(this, 'String', 0, true);
|
|
725
|
+
this.globalNumberType = getGlobalType(this, 'Number', 0, true);
|
|
726
|
+
this.globalBooleanType = getGlobalType(this, 'Boolean', 0, true);
|
|
727
|
+
this.globalRegExpType = getGlobalType(this, 'RegExp', 0, true);
|
|
728
|
+
this.anyArrayType = createArrayType(this, this.anyType);
|
|
729
|
+
let autoArrayType = createArrayType(this, this.autoType);
|
|
730
|
+
// autoArrayType is a marker, so it must be unique even without a global Array type.
|
|
731
|
+
if (autoArrayType === this.emptyObjectType)
|
|
732
|
+
autoArrayType = newAnonymousType(this, undefined);
|
|
733
|
+
this.autoArrayType = autoArrayType;
|
|
734
|
+
let readonlyArrayType = getGlobalType(this, 'ReadonlyArray', 1, false);
|
|
735
|
+
if (readonlyArrayType === this.emptyGenericType)
|
|
736
|
+
readonlyArrayType = this.globalArrayType;
|
|
737
|
+
this.globalReadonlyArrayType = readonlyArrayType;
|
|
738
|
+
this.anyReadonlyArrayType = createTypeFromGenericGlobalType(this, readonlyArrayType, [this.anyType]);
|
|
739
|
+
this.globalThisType = getGlobalType(this, 'ThisType', 1, false);
|
|
740
|
+
this.diagnostics.startLog();
|
|
741
|
+
this.suggestionDiagnostics.startLog();
|
|
742
|
+
mergeAmbientModulesAndAugmentations(this);
|
|
743
|
+
this.mergeDiagnostics.push(this.diagnostics.takeLog(), this.suggestionDiagnostics.takeLog());
|
|
744
|
+
}
|
|
745
|
+
// ---- Public API
|
|
746
|
+
/** Checks `file` if needed and returns its semantic diagnostics, sorted. */
|
|
747
|
+
getDiagnostics(file) {
|
|
748
|
+
const options = this.compilerOptions;
|
|
749
|
+
checkSourceFile(this, file, options.noUnusedLocals === true || options.noUnusedParameters === true);
|
|
750
|
+
return this.diagnostics.forFile(file.fileName);
|
|
751
|
+
}
|
|
752
|
+
/** Checks `file`, including unused identifiers, and returns its suggestion diagnostics. */
|
|
753
|
+
getSuggestionDiagnostics(file) {
|
|
754
|
+
checkSourceFile(this, file, true);
|
|
755
|
+
return this.suggestionDiagnostics.forFile(file.fileName);
|
|
756
|
+
}
|
|
757
|
+
/** Diagnostics without a file, such as missing global types. */
|
|
758
|
+
getGlobalDiagnostics() {
|
|
759
|
+
return this.diagnostics.globals();
|
|
760
|
+
}
|
|
761
|
+
// ---- Links
|
|
762
|
+
/** The rarely used links of `symbol`, created on first use. */
|
|
763
|
+
symbolLinks(symbol) {
|
|
764
|
+
const id = getSymbolId(symbol);
|
|
765
|
+
let links = this.symbolLinkTable.get(id);
|
|
766
|
+
if (links === undefined) {
|
|
767
|
+
links = new SymbolLinks();
|
|
768
|
+
this.symbolLinkTable.set(id, links);
|
|
769
|
+
}
|
|
770
|
+
return links;
|
|
771
|
+
}
|
|
772
|
+
/** The links of `symbol` if it has any, without creating them. */
|
|
773
|
+
existingSymbolLinks(symbol) {
|
|
774
|
+
return this.symbolLinkTable.get(symbol.id);
|
|
775
|
+
}
|
|
776
|
+
/** The rarely used links of `node`, created on first use. */
|
|
777
|
+
nodeLinks(node) {
|
|
778
|
+
const id = node.id;
|
|
779
|
+
let links = this.nodeLinkTable.get(id);
|
|
780
|
+
if (links === undefined) {
|
|
781
|
+
links = new NodeLinks();
|
|
782
|
+
this.nodeLinkTable.set(id, links);
|
|
783
|
+
}
|
|
784
|
+
return links;
|
|
785
|
+
}
|
|
786
|
+
/** The links of `node` if it has any, without creating them. */
|
|
787
|
+
existingNodeLinks(node) {
|
|
788
|
+
return this.nodeLinkTable.get(node.id);
|
|
789
|
+
}
|
|
790
|
+
// ---- Constructors for types, symbols and signatures
|
|
791
|
+
nextTypeId() {
|
|
792
|
+
return ++this.typeCount;
|
|
793
|
+
}
|
|
794
|
+
// TypeChecking: for the methods of types tsc-ts's public API calls.
|
|
795
|
+
baseTypesOf(t) {
|
|
796
|
+
return getBaseTypes(this, t);
|
|
797
|
+
}
|
|
798
|
+
trueTypeOf(t) {
|
|
799
|
+
return getTrueTypeFromConditionalType(this, t);
|
|
800
|
+
}
|
|
801
|
+
falseTypeOf(t) {
|
|
802
|
+
return getFalseTypeFromConditionalType(this, t);
|
|
803
|
+
}
|
|
804
|
+
newIntrinsicType(flags, name, objectFlags) {
|
|
805
|
+
return new IntrinsicType(flags, objectFlags, this.nextTypeId(), name);
|
|
806
|
+
}
|
|
807
|
+
newLiteralType(flags, stringValue, numberValue, symbol) {
|
|
808
|
+
return new LiteralType(flags, this.nextTypeId(), symbol, stringValue, numberValue);
|
|
809
|
+
}
|
|
810
|
+
newTypeParameter(symbol) {
|
|
811
|
+
return new TypeParameter(this.nextTypeId(), symbol);
|
|
812
|
+
}
|
|
813
|
+
newSymbol(flags, name) {
|
|
814
|
+
const symbol = new Symbol(flags | 33554432 /* SymbolFlags.Transient */, name);
|
|
815
|
+
return symbol;
|
|
816
|
+
}
|
|
817
|
+
newSymbolWithCheckFlags(flags, name, checkFlags) {
|
|
818
|
+
const symbol = new Symbol(flags | 33554432 /* SymbolFlags.Transient */, name);
|
|
819
|
+
symbol.checkFlags = checkFlags;
|
|
820
|
+
return symbol;
|
|
821
|
+
}
|
|
822
|
+
newSignature(flags, declaration, typeParameters, thisParameter, parameters, resolvedReturnType, minArgumentCount) {
|
|
823
|
+
return new Signature(++this.signatureCount, flags, declaration, typeParameters, thisParameter, parameters, resolvedReturnType, undefined, minArgumentCount);
|
|
824
|
+
}
|
|
825
|
+
// ---- Diagnostics
|
|
826
|
+
/** Reports `message` at `node`, or as a global diagnostic without a node. */
|
|
827
|
+
error(node, message, ...args) {
|
|
828
|
+
const diagnostic = createDiagnosticForNode(node, message, args);
|
|
829
|
+
this.addDiagnostic(diagnostic);
|
|
830
|
+
return diagnostic;
|
|
831
|
+
}
|
|
832
|
+
addDiagnostic(diagnostic) {
|
|
833
|
+
// Discard diagnostics created while at the maximum number of nested typeToString calls.
|
|
834
|
+
if (this.serializationLevel < maxSerializationLevel)
|
|
835
|
+
this.diagnostics.add(diagnostic);
|
|
836
|
+
}
|
|
837
|
+
addSuggestion(diagnostic) {
|
|
838
|
+
this.suggestionDiagnostics.add(diagnostic);
|
|
839
|
+
}
|
|
840
|
+
/** Reports an error, or a suggestion when `isError` is false. */
|
|
841
|
+
addErrorOrSuggestion(isError, diagnostic) {
|
|
842
|
+
if (isError)
|
|
843
|
+
this.addDiagnostic(diagnostic);
|
|
844
|
+
else
|
|
845
|
+
this.addSuggestion(diagnostic);
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
/**
|
|
849
|
+
* Drops a checker's links and type caches. Native builds free memory by reference counting, and
|
|
850
|
+
* the checker's caches, types and mappers reference each other; releasing them early lets most of
|
|
851
|
+
* them go without a cycle collection.
|
|
852
|
+
*/
|
|
853
|
+
export function disposeChecker(c) {
|
|
854
|
+
c.symbolLinkTable.clear();
|
|
855
|
+
c.nodeLinkTable.clear();
|
|
856
|
+
c.symbolTypes.clear();
|
|
857
|
+
c.symbolTargets.clear();
|
|
858
|
+
c.symbolMappers.clear();
|
|
859
|
+
c.symbolNameTypes.clear();
|
|
860
|
+
c.symbolContainingTypes.clear();
|
|
861
|
+
c.symbolKeyTypes.clear();
|
|
862
|
+
c.symbolSyntheticOrigins.clear();
|
|
863
|
+
c.symbolLeftSpreads.clear();
|
|
864
|
+
c.symbolRightSpreads.clear();
|
|
865
|
+
c.symbolReferenceKinds.clear();
|
|
866
|
+
c.resolvedSymbols.clear();
|
|
867
|
+
c.resolvedTypes.clear();
|
|
868
|
+
c.resolvedSignatures.clear();
|
|
869
|
+
c.spareRelater = undefined;
|
|
870
|
+
if (c.globalChanges !== undefined)
|
|
871
|
+
returnLibGlobals(c);
|
|
872
|
+
else {
|
|
873
|
+
c.mergedSymbols.clear();
|
|
874
|
+
c.globals.clear();
|
|
875
|
+
}
|
|
876
|
+
c.sharedSymbolCopies.clear();
|
|
877
|
+
c.memberPositionsInLists.clear();
|
|
878
|
+
c.memberNamesOfLists.clear();
|
|
879
|
+
c.propertiesByName.clear();
|
|
880
|
+
c.symbolAccessibilityCaches = undefined;
|
|
881
|
+
c.unresolvedSymbols.clear();
|
|
882
|
+
c.undefinedProperties.clear();
|
|
883
|
+
c.stringLiteralTypes.clear();
|
|
884
|
+
c.numberLiteralTypes.clear();
|
|
885
|
+
c.bigintLiteralTypes.clear();
|
|
886
|
+
c.enumLiteralTypes.clear();
|
|
887
|
+
c.uniqueESSymbolTypes.clear();
|
|
888
|
+
c.unionTypesByHash.clear();
|
|
889
|
+
c.unionTypes.clear();
|
|
890
|
+
c.unionOfUnionTypes.clear();
|
|
891
|
+
c.unionOfUnionTypesById.clear();
|
|
892
|
+
c.intersectionTypes.clear();
|
|
893
|
+
c.tupleTypes.clear();
|
|
894
|
+
c.indexedAccessTypes.clear();
|
|
895
|
+
c.templateLiteralTypes.clear();
|
|
896
|
+
c.templateLiteralInstantiations.clear();
|
|
897
|
+
c.stringMappingTypes.clear();
|
|
898
|
+
c.substitutionTypes.clear();
|
|
899
|
+
c.subtypeReductionCache.clear();
|
|
900
|
+
c.cachedTypes.clear();
|
|
901
|
+
c.cachedTypesById.clear();
|
|
902
|
+
c.cachedTypesByPair.clear();
|
|
903
|
+
c.iterationTypesCache.clear();
|
|
904
|
+
c.deferredIterationErrors = [];
|
|
905
|
+
c.deferredCollisionChecks = [];
|
|
906
|
+
c.errorTypes.clear();
|
|
907
|
+
c.globalTypeCache.clear();
|
|
908
|
+
c.globalSymbolCache.clear();
|
|
909
|
+
c.markerTypes.clear();
|
|
910
|
+
c.flowLoopCaches.clear();
|
|
911
|
+
c.flowWalks.clear();
|
|
912
|
+
c.flowNodeReachable.clear();
|
|
913
|
+
c.flowNodePostSuper.clear();
|
|
914
|
+
c.primitiveTypeAliasSuggestions.clear();
|
|
915
|
+
c.patternAmbientModuleAugmentations.clear();
|
|
916
|
+
c.sharedFlowTypes.length = 0;
|
|
917
|
+
c.relationComparers = [];
|
|
918
|
+
}
|
|
919
|
+
/** A diagnostic at `node`'s error range, or a global one without a node. */
|
|
920
|
+
export function createDiagnosticForNode(node, message, args) {
|
|
921
|
+
// Without a node, the diagnostic has no file and an empty range at 0, as in tsgo.
|
|
922
|
+
if (node === undefined)
|
|
923
|
+
return new Diagnostic(undefined, 0, 0, message, args);
|
|
924
|
+
const file = getSourceFileOfNode(node);
|
|
925
|
+
const range = getErrorRangeForNode(file, node);
|
|
926
|
+
return new Diagnostic(file.diagnosticFile(), range.pos, range.end, message, args);
|
|
927
|
+
}
|
|
928
|
+
/** A message for `chainDiagnostic`-style elaboration; the location is taken from the head. */
|
|
929
|
+
export function messageDiagnostic(message, args) {
|
|
930
|
+
return new Diagnostic(undefined, 0, 0, message, args);
|
|
931
|
+
}
|
|
932
|
+
export { ScriptTarget };
|