tsc-ts 0.1.1 → 0.1.3

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.
Files changed (41) hide show
  1. package/README.md +7 -1
  2. package/dist/api/compiler/ast.d.ts +6 -0
  3. package/dist/api/compiler/ast.js +19 -3
  4. package/dist/api/compiler/checker-functions.js +5 -1
  5. package/dist/api/compiler/checker-grammar.d.ts +39 -4
  6. package/dist/api/compiler/checker-grammar.js +239 -75
  7. package/dist/api/compiler/checker-heritage.js +20 -14
  8. package/dist/api/compiler/checker-modules.js +4 -2
  9. package/dist/api/compiler/checker-narrowing.d.ts +7 -0
  10. package/dist/api/compiler/checker-narrowing.js +31 -4
  11. package/dist/api/compiler/checker-source-file.js +16 -1
  12. package/dist/api/compiler/checker-statements.js +11 -2
  13. package/dist/api/compiler/checker-type-factory.js +17 -7
  14. package/dist/api/compiler/checker-type-nodes.d.ts +1 -1
  15. package/dist/api/compiler/checker-type-nodes.js +5 -5
  16. package/dist/api/compiler/checker-unused.js +15 -10
  17. package/dist/api/compiler/checker.d.ts +4 -0
  18. package/dist/api/compiler/checker.js +6 -0
  19. package/dist/api/compiler/file-loader.d.ts +5 -0
  20. package/dist/api/compiler/file-loader.js +7 -0
  21. package/dist/api/compiler/program-checker.d.ts +18 -0
  22. package/dist/api/compiler/program-checker.js +27 -0
  23. package/package.json +14 -9
  24. package/src/compiler/ast.ts +20 -3
  25. package/src/compiler/checker-functions.ts +5 -0
  26. package/src/compiler/checker-grammar.ts +247 -88
  27. package/src/compiler/checker-heritage.ts +31 -17
  28. package/src/compiler/checker-modules.ts +4 -2
  29. package/src/compiler/checker-narrowing.ts +30 -4
  30. package/src/compiler/checker-source-file.ts +16 -1
  31. package/src/compiler/checker-statements.ts +10 -2
  32. package/src/compiler/checker-type-factory.ts +14 -7
  33. package/src/compiler/checker-type-nodes.ts +5 -5
  34. package/src/compiler/checker-unused.ts +13 -8
  35. package/src/compiler/checker.ts +6 -0
  36. package/src/compiler/file-loader.ts +8 -0
  37. package/src/compiler/parallel-check.ts +13 -1
  38. package/src/compiler/parse-thread.ts +24 -2
  39. package/src/compiler/program-checker.ts +28 -0
  40. package/src/compiler/run-records.ts +12 -5
  41. package/src/compiler/tsc-compile.ts +10 -1
package/README.md CHANGED
@@ -33,7 +33,7 @@ npx tsc-ts --noEmit src/index.ts
33
33
 
34
34
  `tsc-ts --api` serves the TypeScript API over stdin and stdout, like `tsc --api`. On Windows, `--api --pipe \\.\pipe\<name>` serves it over a named pipe it creates, as `tsc --api --pipe` does, for clients that connect to the pipe (such as scriptc under Node.js); only the native executable supports `--pipe`. On macOS and Linux, `--api --listen <path>` serves it on a Unix socket it creates, with mode 0600, to one client of the same user at a time, each until the client closes its end. Each client gets the answers a new `tsc-ts --api` process would give, except that symbol ids continue from earlier clients, and the server reads every file through the client again, but it keeps parsed files between clients and reuses those whose text is unchanged, along with the encoding `getSourceFile` sends for each, so a client that opens the same project again loads it faster. The server exits when no client connects for 60 seconds (`--idle-exit <seconds>` sets the time), or after a client when its resident memory is above 2.5 times what it held after its first client (`TSC_TS_LISTEN_MEMORY` sets the limit in megabytes). To stop, it removes the socket file, serves the clients that had connected, and exits. It replaces a socket file that no server answers on, such as one left by a server that was killed. Only the native executable supports `--listen`. With `--default-libraries-from-disk`, the server reads the files in its default library directory (`TSC_TS_LIB_DIR`, or the executable's directory) from the disk itself, even when the client handles file system calls (`--callbacks`), which saves a round trip to the client for each library file.
35
35
 
36
- `--checkers N` checks the program on N threads. Unless `--checkers` or `--singleThreaded` is given, the native executable uses one checker per CPU it may run on (up to 16), and at least tsgo's four; it uses fewer than the CPUs, but never fewer than four, when the estimated peak memory of more checkers would not fit 85% of the machine's memory (`TSC_TS_CHECKERS=fixed` keeps tsgo's four), and checkers beyond the fourth stop taking files, one at a time, when the process's memory reaches that share; it shares one program between its threads and also parses and binds the program's files on them. Unless `--singleThreaded` is given, the program's files are parsed and bound on threads also with `--checkers 1` and in the first build of `--watch`, with or without build info, as tsgo does. Files that share costly declarations, such as a large generated schema and the few files importing it, are checked together on one checker. The checker threads share the results they compute where the run expects that to pay: at 12 or more checkers, when 40% of the program's files are declarations or come from `node_modules` and the checkers' ranges mostly resolve the same large libraries. `TSC_TS_SHARE=1` turns sharing on for any program and `TSC_TS_SHARE=0` keeps it off, and a run whose sharing stops paying stops sharing its results as it goes. A sharing run may also bound how many results it posts at a time, which costs a few percent on a project that does not gain by it and saves more on one that does: the learned choice among a project's runs, off until its record shows it faster, and `TSC_TS_SHARE_BOUNDED=1` turns it on for any program while `TSC_TS_SHARE_BOUNDED=0` keeps it off. `TSC_TS_AUTO=0` keeps the choices of a run before automatic selection (fewer checkers where the ranges resolve large libraries, no sharing), and `TSC_TS_AUTO=static` keeps the rules and the in-run switches but reads and writes no records, and `TSC_TS_AUTO=explore` adds the experimental exploration described below. Unless `--singleThreaded` is given, the files are parsed on the CPUs the process may run on, but one, whatever the checker count, and `TSC_TS_PARSE_THREADS` sets how many. `--extendedDiagnostics` prints the checker threads, the sharing and the parse threads after the statistics table, under `Suggestions:`, with where each value came from (`pinned: --checkers`, `default`, `automatic: ...`, `learned: check 14% faster over 3 runs`, `exploring`, `control`) and how to pin it; `--build` prints one section per project it builds. The section also names the run's record under `Records:`. Each run that checks a program writes what it measured to `~/.cache/tsc-ts/runs-v1/` (`TSC_TS_CACHE_DIR` sets the directory, `TSC_TS_CACHE=0` turns records off), for later runs of the same project on the same machine to read. A later run chooses from that record where the rules left a setting open: a configuration the samples show faster than the static choice — by 3% or twice the standard error of the gains each of its samples makes against the nearest run of the other arm, on three samples of each taken while the machine was not busy — is adopted, every sixteenth run (and the first after two weeks) re-measures the static choice as a control run, and an adopted configuration whose last three samples all fall behind the control runs reverts at once. A run never tries a configuration that could make itself slower: it adopts only what the samples already show faster, from `tsc-ts doctor`, from a pinned run or from a run that already used it. `TSC_TS_AUTO=explore` turns on an experimental alternative in which a run also tries a setting the signals leave uncertain: one run in eight tries three quarters of the count where the library text puts it near the cut, sharing at eight checkers near the rule's limits, or half the parse threads, and such a run is slower than the configuration it would have used. A program whose shape changed by more than 15% discards the record's samples. Watch mode, a `--build` of several projects at once, `--singleThreaded`, Node builds and `TSC_TS_AUTO=0` or `static` keep no record, and the section says why; a run with `CI` set reads and adopts but never explores. `tsc-ts doctor [-p <tsconfig>] [--runs N] [--budget SECONDS] [--emit] [--json] [--no-save]` measures these settings on this machine: it runs the project's check under the default configuration, with sharing on, with up to 16 checkers, with both, and with half the parse threads, compares the phase times by the same rule automatic selection uses, and prints what it recommends with the evidence for it. Each measured run is a child process, so it runs as a user's run would, and it writes what it measured to the file named by `TSC_TS_DOCTOR_REPORT`; runs without the variable are unaffected. Doctor stores its samples in the record with role `doctor`, unless `--no-save` is given. The command is experimental: the configurations it compares and what it recommends may change. Under Node.js, where every thread builds its own copy of the program, tsc-ts checks on one thread unless `--checkers` is given. `--incremental`, `--watch` and `--build` always check on one thread. The diagnostics are the same as with one checker.
36
+ `--checkers N` checks the program on N threads. Unless `--checkers` or `--singleThreaded` is given, the native executable uses one checker per CPU it may run on (up to 16), and at least tsgo's four; it uses fewer than the CPUs, but never fewer than four, when the estimated peak memory of more checkers would not fit 85% of the machine's memory (`TSC_TS_CHECKERS=fixed` keeps tsgo's four), and checkers beyond the fourth stop taking files, one at a time, when the process's memory reaches that share; it shares one program between its threads and also parses and binds the program's files on them. Unless `--singleThreaded` is given, the program's files are parsed and bound on threads also with `--checkers 1` and in the first build of `--watch`, with or without build info, as tsgo does. Files that share costly declarations, such as a large generated schema and the few files importing it, are checked together on one checker. The checker threads share the results they compute where the run expects that to pay: at 12 or more checkers, when 40% of the program's files are declarations or come from `node_modules` and the checkers' ranges mostly resolve the same large libraries. `TSC_TS_SHARE=1` turns sharing on for any program and `TSC_TS_SHARE=0` keeps it off, and a run whose sharing stops paying stops sharing its results as it goes. A sharing run may also bound how many results it posts at a time, which costs a few percent on a project that does not gain by it and saves more on one that does: the learned choice among a project's runs, off until its record shows it faster, and `TSC_TS_SHARE_BOUNDED=1` turns it on for any program while `TSC_TS_SHARE_BOUNDED=0` keeps it off. `TSC_TS_AUTO=0` keeps the choices of a run before automatic selection (fewer checkers where the ranges resolve large libraries, no sharing), and `TSC_TS_AUTO=static` keeps the rules and the in-run switches but reads and writes no records, and `TSC_TS_AUTO=explore` adds the experimental exploration described below. Unless `--singleThreaded` is given, the files are parsed on the CPUs the process may run on, but one, whatever the checker count, and `TSC_TS_PARSE_THREADS` sets how many. `--extendedDiagnostics` prints the checker threads, the sharing and the parse threads after the statistics table, under `Suggestions:`, with where each value came from (`pinned: --checkers`, `default`, `automatic: ...`, `learned: check 14% faster over 3 runs`, `exploring`, `control`) and how to pin it; `--build` prints one section per project it builds. The section also names the run's record under `Records:`. Each run that checks a program writes what it measured to `~/.cache/tsc-ts/runs-v1/` (`TSC_TS_CACHE_DIR` sets the directory, `TSC_TS_CACHE=0` turns records off), for later runs of the same project on the same machine to read. A later run chooses from that record where the rules left a setting open: a configuration the samples show faster than the static choice — by 3% or twice the standard error of the gains each of its samples makes against the nearest run of the other arm, on three samples of each taken while the machine was not busy — is adopted, every sixteenth run (and the first after two weeks) re-measures the static choice as a control run, and an adopted configuration whose last three samples all fall behind the control runs reverts at once. A run never tries a configuration that could make itself slower: it adopts only what the samples already show faster, from `tsc-ts doctor`, from a pinned run or from a run that already used it. `TSC_TS_AUTO=explore` turns on an experimental alternative in which a run also tries a setting the signals leave uncertain: one run in eight tries three quarters of the count where the library text puts it near the cut, sharing at eight checkers near the rule's limits, or half the parse threads, and such a run is slower than the configuration it would have used. A program whose shape changed by more than 15% discards the record's samples. Watch mode, a `--build` of several projects at once, `--singleThreaded`, Node builds and `TSC_TS_AUTO=0` or `static` keep no record, and the section says why; a run with `CI` set reads and adopts but never explores. `tsc-ts doctor [-p <tsconfig>] [--runs N] [--budget SECONDS] [--emit] [--json] [--no-save]` measures these settings on this machine: it runs the project's check under the default configuration, with sharing on, with up to 16 checkers, with both, and with half the parse threads, compares the phase times by the same rule automatic selection uses, and prints what it recommends with the evidence for it. Each measured run is a child process, so it runs as a user's run would, and it writes what it measured to the file named by `TSC_TS_DOCTOR_REPORT`; runs without the variable are unaffected. Doctor stores its samples in the record with role `doctor`, unless `--no-save` is given. The command is experimental: the configurations it compares and what it recommends may change. Under Node.js, where every thread builds its own copy of the program, tsc-ts checks on one thread unless `--checkers` is given. `--incremental`, `--watch` and `--build` always check on one thread. The diagnostics are the same as with one checker, except for the two a check reports when a type instantiation reaches the depth limit: TS5115 on the instantiations, and TS2344 on the constraint check that stops there. Whether a file reaches the limit depends on the declarations its checker has already resolved, and which files a checker has is decided while checking runs, so those two diagnostics are best effort with more than one checker: one run can report them in different files than another run, and a run with one checker can report them where a run with several does not.
37
37
 
38
38
  The native executable never frees syntax trees, types, signatures or symbols: it keeps them until it exits, which saves the cost of tracking them during a build. A one-shot build is unaffected, but a long-running process grows with each rebuild or project update. Native `--watch` (also with `--build`) runs in a child process, and when a change arrives while that process holds more than 2.5 times the memory it held after its first build, a new process replaces it and builds the change, reporting what the old process would have. `TSC_TS_WATCH_MEMORY` sets that limit in megabytes, and `TSC_TS_WATCH_MEMORY=0` turns the replacement off. A `--api` process grows with each project update; restart it to reclaim the memory.
39
39
 
@@ -84,3 +84,9 @@ The program's diagnostics, with their text and positions, are those `tsc --api`
84
84
  An exception the compiler throws while answering a call reaches the caller as an `InternalCompilerError`, with the exception as its `cause`; the program's checker may be inconsistent after one, so dispose of the program. `program.dispose()` frees the program's checkers; calls on the program or its checker after it throw a `DisposedProgramError`.
85
85
 
86
86
  The package has a JavaScript build with declaration files for Node.js, and the TypeScript sources of the API and the compiler (the `source` export condition) for compilers that build it from source. The sources compile with scriptc: a test builds a program on `tsc-ts/api` natively and checks that it answers as the Node build.
87
+
88
+ The API imports `@scriptc/threads`, an optional peer dependency that the command line doesn't use. Install it next to `tsc-ts` to use `tsc-ts/api`:
89
+
90
+ ```bash
91
+ npm install -D tsc-ts @scriptc/threads
92
+ ```
@@ -2327,6 +2327,12 @@ export declare class SourceFile extends Node {
2327
2327
  patternAmbientModules: readonly PatternAmbientModule[];
2328
2328
  /** UMD exports from `export as namespace N`. */
2329
2329
  globalExports: SymbolTable | undefined;
2330
+ /** The diagnostics the parse thread's grammar walk reported for this file. */
2331
+ grammarDiagnostics: Diagnostic[] | undefined;
2332
+ /** The nodes of this file whose grammar check needs the checker, in tree order. */
2333
+ grammarResidualNodes: Node[] | undefined;
2334
+ /** The blocks and statements that reported a statement in an ambient context. */
2335
+ grammarAmbientReports: readonly number[];
2330
2336
  constructor(fileName: string, path: string, text: string, externalModuleIndicatorOptions: ExternalModuleIndicatorOptions, statements: NodeList, endOfFileToken: Token);
2331
2337
  forEachChild(v: NodeVisitor): boolean;
2332
2338
  setParentOfChildren(): void;
@@ -52,9 +52,14 @@ export class NodeVisitor {
52
52
  return this.visitList(list);
53
53
  }
54
54
  }
55
- // Native builds store `pos`, `end` and `id` as 32-bit integers when every write provably stores an
56
- // int32, so writes of values the compiler can't bound (parameters, the id counter) are coerced
57
- // with `| 0`; the values are always int32.
55
+ // Native builds store `pos`, `end` and `id` as 32-bit integers when every write provably stores
56
+ // an int32, so writes of values the compiler can't bound (parameters, the id counter) are
57
+ // coerced with `| 0`; the values are always int32.
58
+ //
59
+ // The fields of a node that the public API's node types declare are stored fields, not values
60
+ // computed from or packed into another field: a native build copies the stored fields of a node
61
+ // into a record when API code narrows one (`node as StringLiteralLike`), and a field behind an
62
+ // accessor is not copied.
58
63
  export class Node {
59
64
  kind;
60
65
  flags;
@@ -6626,6 +6631,7 @@ export const emptyCommentDirectives = [];
6626
6631
  export const emptyPragmas = [];
6627
6632
  export const emptyFileReferences = [];
6628
6633
  export const emptyPatternAmbientModules = [];
6634
+ const emptyNumbers = [];
6629
6635
  /** `list` with `item` appended: a new array when `list` is empty (it may be shared), else `list` itself. */
6630
6636
  export function appendToList(list, item) {
6631
6637
  if (list.length === 0)
@@ -6698,6 +6704,13 @@ export class SourceFile extends Node {
6698
6704
  patternAmbientModules;
6699
6705
  /** UMD exports from `export as namespace N`. */
6700
6706
  globalExports;
6707
+ // Set by the grammar checks of a parse thread (checker-grammar.ts).
6708
+ /** The diagnostics the parse thread's grammar walk reported for this file. */
6709
+ grammarDiagnostics;
6710
+ /** The nodes of this file whose grammar check needs the checker, in tree order. */
6711
+ grammarResidualNodes;
6712
+ /** The blocks and statements that reported a statement in an ambient context. */
6713
+ grammarAmbientReports;
6701
6714
  constructor(fileName, path, text, externalModuleIndicatorOptions, statements, endOfFileToken) {
6702
6715
  super(308 /* SyntaxKind.SourceFile */);
6703
6716
  this.fileName = fileName;
@@ -6744,6 +6757,9 @@ export class SourceFile extends Node {
6744
6757
  this.symbolCount = 0;
6745
6758
  this.patternAmbientModules = emptyPatternAmbientModules;
6746
6759
  this.globalExports = undefined;
6760
+ this.grammarDiagnostics = undefined;
6761
+ this.grammarResidualNodes = undefined;
6762
+ this.grammarAmbientReports = emptyNumbers;
6747
6763
  }
6748
6764
  forEachChild(v) {
6749
6765
  return v.visitList(this.statements) || v.visitNode(this.endOfFileToken);
@@ -33,7 +33,7 @@ import { couldContainTypeVariables, instantiateSignature } from './instantiation
33
33
  import { getContextualSignatureForFunctionLikeDeclaration, getInferenceContext, instantiateContextualType, } from './checker-contextual.js';
34
34
  import { checkJSDocFullSignature, checkJSDocFullSignatureType, checkUnmatchedJSDocParameters, getFullSignatureTypeNode, } from './checker-jsdoc.js';
35
35
  import { getEffectiveCheckNode, isFunctionLike, nodeIsMissing } from './ast-utilities.js';
36
- import { getFlowTypeOfReferenceAt, isConstantReference, isReachableFlowNode, isSymbolAssigned, } from './checker-narrowing.js';
36
+ import { endFlowAnalysisStop, getFlowTypeOfReferenceAt, isConstantReference, isReachableFlowNode, isSymbolAssigned, } from './checker-narrowing.js';
37
37
  import { FlowNode } from './flow.js';
38
38
  import { checkAwaitedType, checkGeneratorInstantiationAssignabilityToReturnType, checkIteratedTypeOrElementType, createGeneratorType, createPromiseReturnType, createPromiseType, getAwaitedTypeEx, getAwaitedTypeNoAlias, getGlobalPromiseTypeChecked, getIterationTypeOfGeneratorFunctionReturnType, getIterationTypeOfIterable, getIterationTypesOfGeneratorFunctionReturnType, getIterationTypesOfIterable, getPromisedTypeOfPromise, isReferenceToType, unwrapAwaitedType, unwrapReturnType, } from './checker-iteration.js';
39
39
  import { typeToString } from './type-printer.js';
@@ -274,6 +274,10 @@ export function checkFunctionLikeBody(c, node) {
274
274
  if (returnType !== undefined)
275
275
  checkReturnExpression(c, node, unwrapReturnType(c, returnType, functionFlags), body, body, exprType, false);
276
276
  }
277
+ // A body too large for control flow analysis stops narrowing in the rest of that body only
278
+ // (flowAnalysisDisabled, checker-narrowing.ts); what follows the body starts over. Inferring the
279
+ // return type above checks the body's return expressions, which can reach the limit.
280
+ endFlowAnalysisStop(c, body);
277
281
  }
278
282
  /** Checks a generator's or async function's return type annotation. */
279
283
  function checkSignatureReturnType(c, node, returnTypeNode, functionFlags) {
@@ -1,10 +1,17 @@
1
1
  import { type Node, type NodeList, NodeVisitor, type ObjectLiteralExpression, type SourceFile } from './ast.js';
2
2
  import { type Checker } from './checker.js';
3
- import { ModuleKind } from './options.js';
3
+ import { Diagnostic, type DiagnosticMessage } from './diagnostics.js';
4
+ import { type CompilerOptions, ModuleKind } from './options.js';
4
5
  import { SourceFileMetadata } from './program-utilities.js';
5
6
  import { Scanner } from './scanner.js';
6
7
  /** Runs the grammar checks of every node of `file`. */
7
8
  export declare function checkGrammarSourceFile(c: Checker, file: SourceFile): void;
9
+ /**
10
+ * Runs the grammar checks of `file` in a parse thread, before the file is published: the checks that
11
+ * don't need the checker report now, and the nodes of those that do are kept for the checker, which
12
+ * runs them in the same tree order (`checkGrammarSourceFile`).
13
+ */
14
+ export declare function checkGrammarSourceFileInParseThread(file: SourceFile, options: CompilerOptions, metadata: SourceFileMetadata): void;
8
15
  /** Checks the grammar of an object literal each time it is checked, as tsgo does. */
9
16
  export declare function checkGrammarObjectLiteralOfExpression(c: Checker, node: ObjectLiteralExpression, inDestructuring: boolean): void;
10
17
  /** Reports a trailing comma after the rest element of a destructuring assignment. */
@@ -17,7 +24,10 @@ export declare function checkGrammarAwaitExpression(c: Checker, node: Node): voi
17
24
  export declare function checkGrammarYieldOfExpression(c: Checker, node: Node): void;
18
25
  /** Per-file state of the grammar walk. */
19
26
  export declare class GrammarChecker extends NodeVisitor {
20
- readonly c: Checker;
27
+ /** The checker of a walk in the checker thread; undefined for a walk in a parse thread. */
28
+ readonly c: Checker | undefined;
29
+ readonly compilerOptions: CompilerOptions;
30
+ readonly languageVersion: number;
21
31
  readonly file: SourceFile;
22
32
  /** Grammar errors are only reported in files without parse errors. */
23
33
  readonly hasParseErrors: boolean;
@@ -25,10 +35,35 @@ export declare class GrammarChecker extends NodeVisitor {
25
35
  readonly metadata: SourceFileMetadata;
26
36
  readonly legacyDecorators: boolean;
27
37
  /** Blocks and statements that already reported a statement in an ambient context. */
28
- readonly reportedAmbientStatements: Set<number>;
38
+ reportedAmbientStatements: Set<number>;
39
+ /**
40
+ * The IDs `reportedAmbientStatements` gained in a parse thread's walk, in the order it gained them, so
41
+ * that the reports of a node whose check the checker runs are undone without copying the set.
42
+ * Undefined in the checker thread, where no check is undone.
43
+ */
44
+ private readonly ambientReportLog;
45
+ /**
46
+ * The diagnostics of a walk in a parse thread, which has no checker, for the checker to add to its
47
+ * collection; undefined in the checker thread, where they are reported as they are found.
48
+ */
49
+ readonly diagnostics: Diagnostic[] | undefined;
50
+ /** The nodes of a parse thread's walk whose check needs the checker, in tree order. */
51
+ readonly residualNodes: Node[] | undefined;
52
+ /** Set when the check of a parse thread's walk needs the checker: the checker runs that node. */
53
+ needsChecker: boolean;
29
54
  private scanner;
30
- constructor(c: Checker, file: SourceFile);
55
+ constructor(c: Checker | undefined, file: SourceFile, options?: CompilerOptions, metadata?: SourceFileMetadata,
56
+ /** `file.grammarAmbientReports`: what a parse thread's walk already reported. */
57
+ ambientReports?: readonly number[]);
31
58
  visitNode(node: Node): boolean;
59
+ /** Records that `id` reported a statement in an ambient context. */
60
+ reportAmbientStatement(id: number): void;
61
+ /** Undoes the ambient-context reports added since the log had `mark` entries. */
62
+ private undoAmbientReports;
63
+ /** Reports an error at `node`, as `Checker.error`; returns the diagnostic. */
64
+ error(node: Node | undefined, message: DiagnosticMessage, ...args: string[]): Diagnostic;
65
+ /** Reports `diagnostic`, as `Checker.addDiagnostic`. */
66
+ report(diagnostic: Diagnostic): void;
32
67
  /** A scanner over the file's text, for rescanning tokens. */
33
68
  getScanner(): Scanner;
34
69
  }