tsc-ts 0.0.5 → 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 +1 -1
- package/dist/api/compiler/ast.d.ts +10 -9
- package/dist/api/compiler/ast.js +22 -16
- package/dist/api/compiler/binder-utilities.js +2 -1
- package/dist/api/compiler/binder.js +9 -8
- package/dist/api/compiler/checker-calls.js +3 -2
- package/dist/api/compiler/checker-declaration-order.js +2 -1
- package/dist/api/compiler/checker-declarations.js +14 -14
- package/dist/api/compiler/checker-declared-types.d.ts +1 -1
- package/dist/api/compiler/checker-declared-types.js +12 -11
- package/dist/api/compiler/checker-decorators.js +3 -3
- package/dist/api/compiler/checker-deprecation.js +17 -18
- package/dist/api/compiler/checker-destructuring.d.ts +1 -1
- package/dist/api/compiler/checker-destructuring.js +3 -3
- package/dist/api/compiler/checker-elaboration.js +8 -7
- package/dist/api/compiler/checker-emit-resolver.d.ts +1 -1
- package/dist/api/compiler/checker-emit-resolver.js +5 -4
- package/dist/api/compiler/checker-grammar.js +18 -4
- package/dist/api/compiler/checker-heritage.d.ts +1 -1
- package/dist/api/compiler/checker-heritage.js +14 -13
- package/dist/api/compiler/checker-inference.d.ts +1 -1
- package/dist/api/compiler/checker-inference.js +9 -9
- package/dist/api/compiler/checker-javascript.d.ts +1 -1
- package/dist/api/compiler/checker-javascript.js +5 -4
- package/dist/api/compiler/checker-jsx.d.ts +1 -1
- package/dist/api/compiler/checker-jsx.js +4 -4
- package/dist/api/compiler/checker-literals.js +2 -2
- package/dist/api/compiler/checker-members.d.ts +5 -3
- package/dist/api/compiler/checker-members.js +75 -53
- package/dist/api/compiler/checker-modules.d.ts +1 -1
- package/dist/api/compiler/checker-modules.js +13 -13
- package/dist/api/compiler/checker-object-literals.d.ts +1 -1
- package/dist/api/compiler/checker-object-literals.js +11 -7
- package/dist/api/compiler/checker-overloads.d.ts +1 -1
- package/dist/api/compiler/checker-overloads.js +4 -3
- package/dist/api/compiler/checker-property-access.d.ts +1 -1
- package/dist/api/compiler/checker-property-access.js +2 -2
- package/dist/api/compiler/checker-services.js +2 -2
- package/dist/api/compiler/checker-signatures.d.ts +1 -1
- package/dist/api/compiler/checker-signatures.js +9 -8
- package/dist/api/compiler/checker-symbol-types.d.ts +2 -18
- package/dist/api/compiler/checker-symbol-types.js +22 -952
- package/dist/api/compiler/checker-symbols.d.ts +2 -2
- package/dist/api/compiler/checker-symbols.js +29 -27
- package/dist/api/compiler/checker-type-factory.d.ts +2 -2
- package/dist/api/compiler/checker-type-factory.js +57 -16
- package/dist/api/compiler/checker-type-nodes.d.ts +1 -1
- package/dist/api/compiler/checker-type-nodes.js +2 -2
- package/dist/api/compiler/checker-type-operators.d.ts +1 -1
- package/dist/api/compiler/checker-type-operators.js +5 -5
- package/dist/api/compiler/checker-types.d.ts +73 -7
- package/dist/api/compiler/checker-types.js +220 -43
- package/dist/api/compiler/checker-unused.d.ts +1 -1
- package/dist/api/compiler/checker-unused.js +3 -3
- package/dist/api/compiler/checker.d.ts +29 -8
- package/dist/api/compiler/checker.js +29 -9
- package/dist/api/compiler/diagnostics.d.ts +2 -8
- package/dist/api/compiler/diagnostics.js +4 -40
- package/dist/api/compiler/file-include.d.ts +35 -8
- package/dist/api/compiler/file-include.js +81 -18
- package/dist/api/compiler/file-loader.d.ts +33 -4
- package/dist/api/compiler/file-loader.js +90 -24
- package/dist/api/compiler/instantiation.d.ts +1 -1
- package/dist/api/compiler/instantiation.js +86 -50
- package/dist/api/compiler/link-tables.d.ts +69 -0
- package/dist/api/compiler/link-tables.js +236 -0
- package/dist/api/compiler/name-resolver.js +3 -3
- package/dist/api/compiler/node-builder-names.d.ts +1 -1
- package/dist/api/compiler/node-builder-names.js +12 -12
- package/dist/api/compiler/node-builder-pseudo.d.ts +1 -1
- package/dist/api/compiler/node-builder-pseudo.js +2 -1
- package/dist/api/compiler/node-builder.d.ts +1 -1
- package/dist/api/compiler/node-builder.js +16 -16
- package/dist/api/compiler/parallel-parse.d.ts +2 -0
- package/dist/api/compiler/parallel-parse.js +4 -0
- package/dist/api/compiler/parser.d.ts +33 -16
- package/dist/api/compiler/parser.js +95 -76
- package/dist/api/compiler/printer/emit-context.d.ts +5 -2
- package/dist/api/compiler/printer/emit-context.js +19 -13
- package/dist/api/compiler/program-checker.js +3 -0
- package/dist/api/compiler/program.js +9 -1
- package/dist/api/compiler/relations.d.ts +1 -1
- package/dist/api/compiler/relations.js +10 -10
- package/dist/api/compiler/symbol-accessibility.d.ts +1 -1
- package/dist/api/compiler/symbol-accessibility.js +123 -26
- package/dist/api/compiler/symbol.d.ts +45 -3
- package/dist/api/compiler/symbol.js +121 -10
- package/dist/api/compiler/transformers/alias-references.d.ts +1 -1
- package/dist/api/compiler/transformers/alias-references.js +2 -1
- package/dist/api/compiler/transformers/declarations-diagnostics.js +2 -1
- package/dist/api/compiler/transformers/declarations-pseudo.js +4 -2
- package/dist/api/compiler/transformers/declarations-syntactic.d.ts +1 -1
- package/dist/api/compiler/transformers/declarations-syntactic.js +9 -9
- package/dist/api/compiler/transformers/declarations-tracker.d.ts +1 -1
- package/dist/api/compiler/transformers/declarations-tracker.js +3 -2
- package/dist/api/compiler/transformers/declarations.js +6 -5
- package/dist/api/compiler/transformers/reference-resolver.d.ts +2 -1
- package/dist/api/compiler/transformers/reference-resolver.js +26 -24
- package/dist/api/compiler/transformers/subtree-facts.d.ts +1 -0
- package/dist/api/compiler/transformers/subtree-facts.js +7 -5
- package/dist/api/compiler/transformers/syntax-facts.d.ts +1 -0
- package/dist/api/compiler/transformers/syntax-facts.js +9 -5
- package/dist/api/compiler/transformers/type-serialization.js +12 -12
- package/package.json +9 -9
- package/src/compiler/ast.ts +27 -19
- package/src/compiler/binder-utilities.ts +2 -2
- package/src/compiler/binder.ts +15 -11
- package/src/compiler/checker-calls.ts +3 -3
- package/src/compiler/checker-declaration-order.ts +2 -2
- package/src/compiler/checker-declarations.ts +21 -14
- package/src/compiler/checker-declared-types.ts +12 -12
- package/src/compiler/checker-decorators.ts +3 -3
- package/src/compiler/checker-deprecation.ts +17 -21
- package/src/compiler/checker-destructuring.ts +3 -3
- package/src/compiler/checker-elaboration.ts +8 -8
- package/src/compiler/checker-emit-resolver.ts +5 -5
- package/src/compiler/checker-grammar.ts +17 -5
- package/src/compiler/checker-heritage.ts +21 -14
- package/src/compiler/checker-inference.ts +17 -9
- package/src/compiler/checker-javascript.ts +5 -5
- package/src/compiler/checker-jsx.ts +12 -8
- package/src/compiler/checker-literals.ts +2 -2
- package/src/compiler/checker-members.ts +91 -47
- package/src/compiler/checker-modules.ts +23 -13
- package/src/compiler/checker-object-literals.ts +22 -6
- package/src/compiler/checker-overloads.ts +6 -6
- package/src/compiler/checker-property-access.ts +2 -2
- package/src/compiler/checker-services.ts +2 -2
- package/src/compiler/checker-signatures.ts +9 -9
- package/src/compiler/checker-symbol-types.ts +20 -940
- package/src/compiler/checker-symbols.ts +42 -35
- package/src/compiler/checker-type-factory.ts +53 -16
- package/src/compiler/checker-type-nodes.ts +2 -2
- package/src/compiler/checker-type-operators.ts +13 -5
- package/src/compiler/checker-types.ts +223 -43
- package/src/compiler/checker-unused.ts +3 -3
- package/src/compiler/checker.ts +31 -9
- package/src/compiler/diagnostics.ts +5 -44
- package/src/compiler/file-include.ts +85 -17
- package/src/compiler/file-loader.ts +104 -35
- package/src/compiler/incremental.ts +39 -5
- package/src/compiler/instantiation.ts +99 -55
- package/src/compiler/link-tables.ts +245 -0
- package/src/compiler/name-resolver.ts +3 -3
- package/src/compiler/node-builder-names.ts +21 -19
- package/src/compiler/node-builder-pseudo.ts +2 -2
- package/src/compiler/node-builder.ts +24 -16
- package/src/compiler/parallel-check.ts +11 -8
- package/src/compiler/parallel-parse.ts +5 -0
- package/src/compiler/parse-thread.ts +0 -4
- package/src/compiler/parser.ts +120 -70
- package/src/compiler/printer/emit-context.ts +20 -15
- package/src/compiler/program-checker.ts +2 -0
- package/src/compiler/program.ts +8 -1
- package/src/compiler/relations.ts +10 -10
- package/src/compiler/symbol-accessibility.ts +120 -25
- package/src/compiler/symbol.ts +127 -9
- package/src/compiler/transformers/alias-references.ts +2 -2
- package/src/compiler/transformers/declarations-diagnostics.ts +2 -1
- package/src/compiler/transformers/declarations-pseudo.ts +7 -4
- package/src/compiler/transformers/declarations-syntactic.ts +17 -9
- package/src/compiler/transformers/declarations-tracker.ts +3 -3
- package/src/compiler/transformers/declarations.ts +6 -6
- package/src/compiler/transformers/reference-resolver.ts +37 -25
- package/src/compiler/transformers/subtree-facts.ts +13 -5
- package/src/compiler/transformers/syntax-facts.ts +10 -5
- package/src/compiler/transformers/type-serialization.ts +12 -12
- package/src/compiler/tsc-build.ts +17 -13
- package/src/compiler/tsc-cli.ts +9 -6
- package/src/compiler/tsc-compile.ts +16 -7
- package/src/compiler/tsc-watch.ts +94 -26
|
@@ -30,7 +30,6 @@ import {
|
|
|
30
30
|
getDeclarationOfKind,
|
|
31
31
|
} from './binder-utilities.js';
|
|
32
32
|
import { Diagnostics } from './diagnostics.js';
|
|
33
|
-
import { InternalSymbolName, type Symbol, SymbolFlags } from './symbol.js';
|
|
34
33
|
import { SyntaxKind } from './syntax-kind.js';
|
|
35
34
|
import type { Checker } from './checker.js';
|
|
36
35
|
import {
|
|
@@ -111,6 +110,7 @@ import { isTypeAssignableTo, type TypeComparer } from './relations.js';
|
|
|
111
110
|
import { getReturnTypeFromBody, getTypePredicateFromBody } from './checker-functions.js';
|
|
112
111
|
import { checkComputedPropertyName } from './checker-expressions.js';
|
|
113
112
|
import { hasLateBindableIndexSignature } from './checker-utilities.js';
|
|
113
|
+
import { declarationCount, getDeclarations, InternalSymbolName, type Symbol, SymbolFlags } from './symbol.js';
|
|
114
114
|
|
|
115
115
|
// ---- From declarations
|
|
116
116
|
|
|
@@ -118,7 +118,7 @@ import { hasLateBindableIndexSignature } from './checker-utilities.js';
|
|
|
118
118
|
export function getSignaturesOfSymbol(c: Checker, symbol: Symbol | undefined): Signature[] {
|
|
119
119
|
if (symbol === undefined) return [];
|
|
120
120
|
const result: Signature[] = [];
|
|
121
|
-
const declarations = symbol
|
|
121
|
+
const declarations = getDeclarations(symbol);
|
|
122
122
|
for (let i = 0; i < declarations.length; i++) {
|
|
123
123
|
const decl = declarations[i]!;
|
|
124
124
|
if (!isFunctionLikeNode(decl)) continue;
|
|
@@ -362,7 +362,7 @@ export function getReturnTypeFromAnnotation(c: Checker, declaration: Node): Type
|
|
|
362
362
|
if (declaration.kind === SyntaxKind.GetAccessor) {
|
|
363
363
|
const symbol = getSymbolOfDeclaration(c, declaration);
|
|
364
364
|
if (symbol !== undefined) {
|
|
365
|
-
const setter = symbol.
|
|
365
|
+
const setter = getDeclarations(symbol).find((d) => d.kind === SyntaxKind.SetAccessor);
|
|
366
366
|
if (setter !== undefined) {
|
|
367
367
|
const parameters = getParameters(setter);
|
|
368
368
|
if (parameters !== undefined) {
|
|
@@ -898,7 +898,7 @@ export function getIndexInfosOfIndexSymbol(c: Checker, indexSymbol: Symbol, sibl
|
|
|
898
898
|
let readonlyNumber = true;
|
|
899
899
|
let readonlySymbol = true;
|
|
900
900
|
const propertySymbols: Symbol[] = [];
|
|
901
|
-
for (const declaration of indexSymbol
|
|
901
|
+
for (const declaration of getDeclarations(indexSymbol)) {
|
|
902
902
|
if (declaration.kind === SyntaxKind.IndexSignature) {
|
|
903
903
|
const parameters = getParameters(declaration)?.nodes ?? [];
|
|
904
904
|
const returnTypeNode = getType(declaration);
|
|
@@ -952,7 +952,7 @@ import { ContextFlags, getContextualTypeEx } from './checker-contextual.js';
|
|
|
952
952
|
/** Whether `symbol` is a known symbol or has a computed name of a symbol type. */
|
|
953
953
|
function isSymbolWithSymbolName(c: Checker, symbol: Symbol): boolean {
|
|
954
954
|
if (symbol.name.startsWith('\ufffe@')) return true;
|
|
955
|
-
const name = symbol
|
|
955
|
+
const name = declarationCount(symbol) !== 0 ? getName(symbol.declaration!) : undefined;
|
|
956
956
|
return (
|
|
957
957
|
name !== undefined &&
|
|
958
958
|
name.kind === SyntaxKind.ComputedPropertyName &&
|
|
@@ -963,7 +963,7 @@ function isSymbolWithSymbolName(c: Checker, symbol: Symbol): boolean {
|
|
|
963
963
|
/** Whether `symbol` has a numeric name, or a computed name of a number type. */
|
|
964
964
|
function isSymbolWithNumericName(c: Checker, symbol: Symbol): boolean {
|
|
965
965
|
if (isNumericLiteralName(symbol.name)) return true;
|
|
966
|
-
const name = symbol
|
|
966
|
+
const name = declarationCount(symbol) !== 0 ? getName(symbol.declaration!) : undefined;
|
|
967
967
|
if (name === undefined) return false;
|
|
968
968
|
if (name.kind === SyntaxKind.ComputedPropertyName)
|
|
969
969
|
return isTypeAssignableToKind(c, checkComputedPropertyName(c, name), TypeFlags.NumberLike);
|
|
@@ -985,7 +985,7 @@ function getObjectLiteralIndexInfo(c: Checker, isReadonly: boolean, properties:
|
|
|
985
985
|
(keyType === c.esSymbolType && isSymbolWithSymbolName(c, prop))
|
|
986
986
|
) {
|
|
987
987
|
propTypes.push(getTypeOfSymbol(c, prop));
|
|
988
|
-
if (isSymbolWithComputedName(prop)) components.push(prop.
|
|
988
|
+
if (isSymbolWithComputedName(prop)) components.push(prop.declaration!);
|
|
989
989
|
}
|
|
990
990
|
}
|
|
991
991
|
const unionType =
|
|
@@ -996,8 +996,8 @@ function getObjectLiteralIndexInfo(c: Checker, isReadonly: boolean, properties:
|
|
|
996
996
|
}
|
|
997
997
|
|
|
998
998
|
function isSymbolWithComputedName(symbol: Symbol): boolean {
|
|
999
|
-
if (symbol
|
|
1000
|
-
const name = getName(symbol.
|
|
999
|
+
if (declarationCount(symbol) === 0) return false;
|
|
1000
|
+
const name = getName(symbol.declaration!);
|
|
1001
1001
|
return name !== undefined && name.kind === SyntaxKind.ComputedPropertyName;
|
|
1002
1002
|
}
|
|
1003
1003
|
|