Skip to content

Commit 35dde28

Browse files
Merge pull request #1914 from Microsoft/internalAPIs
Remove certain lazyily initialized fields from the public DTS.
2 parents fab351e + 2ee134c commit 35dde28

14 files changed

+60
-111
lines changed

Jakefile

+8-2
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ var compilerFilename = "tsc.js";
194194
* @param keepComments: false to compile using --removeComments
195195
* @param callback: a function to execute after the compilation process ends
196196
*/
197-
function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, noOutFile, generateDeclarations, outDir, preserveConstEnums, keepComments, noResolve, callback) {
197+
function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, noOutFile, generateDeclarations, outDir, preserveConstEnums, keepComments, noResolve, stripInternal, callback) {
198198
file(outFile, prereqs, function() {
199199
var dir = useBuiltCompiler ? builtLocalDirectory : LKGDirectory;
200200
var options = "--module commonjs -noImplicitAny";
@@ -227,6 +227,10 @@ function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, noOu
227227
options += " -sourcemap -mapRoot file:///" + path.resolve(path.dirname(outFile));
228228
}
229229

230+
if (stripInternal) {
231+
options += " --stripInternal"
232+
}
233+
230234
var cmd = host + " " + dir + compilerFilename + " " + options + " ";
231235
cmd = cmd + sources.join(" ");
232236
console.log(cmd + "\n");
@@ -331,7 +335,8 @@ compileFile(servicesFile, servicesSources,[builtLocalDirectory, copyright].conca
331335
/*outDir*/ undefined,
332336
/*preserveConstEnums*/ true,
333337
/*keepComments*/ false,
334-
/*noResolve*/ false);
338+
/*noResolve*/ false,
339+
/*stripInternal*/ false);
335340

336341
var nodeDefinitionsFile = path.join(builtLocalDirectory, "typescript.d.ts");
337342
var standaloneDefinitionsFile = path.join(builtLocalDirectory, "typescriptServices.d.ts");
@@ -347,6 +352,7 @@ compileFile(nodeDefinitionsFile, servicesSources,[builtLocalDirectory, copyright
347352
/*preserveConstEnums*/ true,
348353
/*keepComments*/ true,
349354
/*noResolve*/ true,
355+
/*stripInternal*/ true,
350356
/*callback*/ function () {
351357
function makeDefinitionFiles(definitionsRoots, standaloneDefinitionsFile, nodeDefinitionsFile) {
352358
// Create the standalone definition file

src/compiler/types.ts

+16-13
Original file line numberDiff line numberDiff line change
@@ -891,30 +891,33 @@ module ts {
891891
amdModuleName: string;
892892
referencedFiles: FileReference[];
893893

894+
hasNoDefaultLib: boolean;
895+
externalModuleIndicator: Node; // The first node that causes this file to be an external module
896+
nodeCount: number;
897+
identifierCount: number;
898+
symbolCount: number;
899+
languageVersion: ScriptTarget;
900+
identifiers: Map<string>;
901+
902+
// @internal
894903
// Diagnostics reported about the "///<reference" comments in the file.
895904
referenceDiagnostics: Diagnostic[];
896-
905+
906+
// @internal
897907
// Parse errors refer specifically to things the parser could not understand at all (like
898908
// missing tokens, or tokens it didn't know how to deal with).
899909
parseDiagnostics: Diagnostic[];
900-
901-
//getSyntacticDiagnostics(): Diagnostic[];
902-
910+
911+
// @internal
903912
// File level diagnostics reported by the binder.
904913
semanticDiagnostics: Diagnostic[];
905-
914+
915+
// @internal
906916
// Returns all syntactic diagnostics (i.e. the reference, parser and grammar diagnostics).
907917
// This field should never be used directly, use getSyntacticDiagnostics function instead.
908918
syntacticDiagnostics: Diagnostic[];
909919

910-
hasNoDefaultLib: boolean;
911-
externalModuleIndicator: Node; // The first node that causes this file to be an external module
912-
nodeCount: number;
913-
identifierCount: number;
914-
symbolCount: number;
915-
languageVersion: ScriptTarget;
916-
identifiers: Map<string>;
917-
920+
// @internal
918921
// Stores a line map for the file.
919922
// This field should never be used directly to obtain line map, use getLineMap function instead.
920923
lineMap: number[];

tests/baselines/reference/APISample_compile.js

+2-5
Original file line numberDiff line numberDiff line change
@@ -728,18 +728,13 @@ declare module "typescript" {
728728
amdDependencies: string[];
729729
amdModuleName: string;
730730
referencedFiles: FileReference[];
731-
referenceDiagnostics: Diagnostic[];
732-
parseDiagnostics: Diagnostic[];
733-
semanticDiagnostics: Diagnostic[];
734-
syntacticDiagnostics: Diagnostic[];
735731
hasNoDefaultLib: boolean;
736732
externalModuleIndicator: Node;
737733
nodeCount: number;
738734
identifierCount: number;
739735
symbolCount: number;
740736
languageVersion: ScriptTarget;
741737
identifiers: Map<string>;
742-
lineMap: number[];
743738
}
744739
interface ScriptReferenceHost {
745740
getCompilerOptions(): CompilerOptions;
@@ -1186,6 +1181,7 @@ declare module "typescript" {
11861181
target?: ScriptTarget;
11871182
version?: boolean;
11881183
watch?: boolean;
1184+
stripInternal?: boolean;
11891185
[option: string]: string | number | boolean;
11901186
}
11911187
const enum ModuleKind {
@@ -1216,6 +1212,7 @@ declare module "typescript" {
12161212
description?: DiagnosticMessage;
12171213
paramType?: DiagnosticMessage;
12181214
error?: DiagnosticMessage;
1215+
experimental?: boolean;
12191216
}
12201217
const enum CharacterCodes {
12211218
nullCharacter = 0,

tests/baselines/reference/APISample_compile.types

+6-19
Original file line numberDiff line numberDiff line change
@@ -2219,22 +2219,6 @@ declare module "typescript" {
22192219
>referencedFiles : FileReference[]
22202220
>FileReference : FileReference
22212221

2222-
referenceDiagnostics: Diagnostic[];
2223-
>referenceDiagnostics : Diagnostic[]
2224-
>Diagnostic : Diagnostic
2225-
2226-
parseDiagnostics: Diagnostic[];
2227-
>parseDiagnostics : Diagnostic[]
2228-
>Diagnostic : Diagnostic
2229-
2230-
semanticDiagnostics: Diagnostic[];
2231-
>semanticDiagnostics : Diagnostic[]
2232-
>Diagnostic : Diagnostic
2233-
2234-
syntacticDiagnostics: Diagnostic[];
2235-
>syntacticDiagnostics : Diagnostic[]
2236-
>Diagnostic : Diagnostic
2237-
22382222
hasNoDefaultLib: boolean;
22392223
>hasNoDefaultLib : boolean
22402224

@@ -2258,9 +2242,6 @@ declare module "typescript" {
22582242
identifiers: Map<string>;
22592243
>identifiers : Map<string>
22602244
>Map : Map<T>
2261-
2262-
lineMap: number[];
2263-
>lineMap : number[]
22642245
}
22652246
interface ScriptReferenceHost {
22662247
>ScriptReferenceHost : ScriptReferenceHost
@@ -3818,6 +3799,9 @@ declare module "typescript" {
38183799
watch?: boolean;
38193800
>watch : boolean
38203801

3802+
stripInternal?: boolean;
3803+
>stripInternal : boolean
3804+
38213805
[option: string]: string | number | boolean;
38223806
>option : string
38233807
}
@@ -3898,6 +3882,9 @@ declare module "typescript" {
38983882
error?: DiagnosticMessage;
38993883
>error : DiagnosticMessage
39003884
>DiagnosticMessage : DiagnosticMessage
3885+
3886+
experimental?: boolean;
3887+
>experimental : boolean
39013888
}
39023889
const enum CharacterCodes {
39033890
>CharacterCodes : CharacterCodes

tests/baselines/reference/APISample_linter.js

+2-5
Original file line numberDiff line numberDiff line change
@@ -757,18 +757,13 @@ declare module "typescript" {
757757
amdDependencies: string[];
758758
amdModuleName: string;
759759
referencedFiles: FileReference[];
760-
referenceDiagnostics: Diagnostic[];
761-
parseDiagnostics: Diagnostic[];
762-
semanticDiagnostics: Diagnostic[];
763-
syntacticDiagnostics: Diagnostic[];
764760
hasNoDefaultLib: boolean;
765761
externalModuleIndicator: Node;
766762
nodeCount: number;
767763
identifierCount: number;
768764
symbolCount: number;
769765
languageVersion: ScriptTarget;
770766
identifiers: Map<string>;
771-
lineMap: number[];
772767
}
773768
interface ScriptReferenceHost {
774769
getCompilerOptions(): CompilerOptions;
@@ -1215,6 +1210,7 @@ declare module "typescript" {
12151210
target?: ScriptTarget;
12161211
version?: boolean;
12171212
watch?: boolean;
1213+
stripInternal?: boolean;
12181214
[option: string]: string | number | boolean;
12191215
}
12201216
const enum ModuleKind {
@@ -1245,6 +1241,7 @@ declare module "typescript" {
12451241
description?: DiagnosticMessage;
12461242
paramType?: DiagnosticMessage;
12471243
error?: DiagnosticMessage;
1244+
experimental?: boolean;
12481245
}
12491246
const enum CharacterCodes {
12501247
nullCharacter = 0,

tests/baselines/reference/APISample_linter.types

+6-19
Original file line numberDiff line numberDiff line change
@@ -2349,22 +2349,6 @@ declare module "typescript" {
23492349
>referencedFiles : FileReference[]
23502350
>FileReference : FileReference
23512351

2352-
referenceDiagnostics: Diagnostic[];
2353-
>referenceDiagnostics : Diagnostic[]
2354-
>Diagnostic : Diagnostic
2355-
2356-
parseDiagnostics: Diagnostic[];
2357-
>parseDiagnostics : Diagnostic[]
2358-
>Diagnostic : Diagnostic
2359-
2360-
semanticDiagnostics: Diagnostic[];
2361-
>semanticDiagnostics : Diagnostic[]
2362-
>Diagnostic : Diagnostic
2363-
2364-
syntacticDiagnostics: Diagnostic[];
2365-
>syntacticDiagnostics : Diagnostic[]
2366-
>Diagnostic : Diagnostic
2367-
23682352
hasNoDefaultLib: boolean;
23692353
>hasNoDefaultLib : boolean
23702354

@@ -2388,9 +2372,6 @@ declare module "typescript" {
23882372
identifiers: Map<string>;
23892373
>identifiers : Map<string>
23902374
>Map : Map<T>
2391-
2392-
lineMap: number[];
2393-
>lineMap : number[]
23942375
}
23952376
interface ScriptReferenceHost {
23962377
>ScriptReferenceHost : ScriptReferenceHost
@@ -3948,6 +3929,9 @@ declare module "typescript" {
39483929
watch?: boolean;
39493930
>watch : boolean
39503931

3932+
stripInternal?: boolean;
3933+
>stripInternal : boolean
3934+
39513935
[option: string]: string | number | boolean;
39523936
>option : string
39533937
}
@@ -4028,6 +4012,9 @@ declare module "typescript" {
40284012
error?: DiagnosticMessage;
40294013
>error : DiagnosticMessage
40304014
>DiagnosticMessage : DiagnosticMessage
4015+
4016+
experimental?: boolean;
4017+
>experimental : boolean
40314018
}
40324019
const enum CharacterCodes {
40334020
>CharacterCodes : CharacterCodes

tests/baselines/reference/APISample_transform.js

+2-5
Original file line numberDiff line numberDiff line change
@@ -758,18 +758,13 @@ declare module "typescript" {
758758
amdDependencies: string[];
759759
amdModuleName: string;
760760
referencedFiles: FileReference[];
761-
referenceDiagnostics: Diagnostic[];
762-
parseDiagnostics: Diagnostic[];
763-
semanticDiagnostics: Diagnostic[];
764-
syntacticDiagnostics: Diagnostic[];
765761
hasNoDefaultLib: boolean;
766762
externalModuleIndicator: Node;
767763
nodeCount: number;
768764
identifierCount: number;
769765
symbolCount: number;
770766
languageVersion: ScriptTarget;
771767
identifiers: Map<string>;
772-
lineMap: number[];
773768
}
774769
interface ScriptReferenceHost {
775770
getCompilerOptions(): CompilerOptions;
@@ -1216,6 +1211,7 @@ declare module "typescript" {
12161211
target?: ScriptTarget;
12171212
version?: boolean;
12181213
watch?: boolean;
1214+
stripInternal?: boolean;
12191215
[option: string]: string | number | boolean;
12201216
}
12211217
const enum ModuleKind {
@@ -1246,6 +1242,7 @@ declare module "typescript" {
12461242
description?: DiagnosticMessage;
12471243
paramType?: DiagnosticMessage;
12481244
error?: DiagnosticMessage;
1245+
experimental?: boolean;
12491246
}
12501247
const enum CharacterCodes {
12511248
nullCharacter = 0,

tests/baselines/reference/APISample_transform.types

+6-19
Original file line numberDiff line numberDiff line change
@@ -2297,22 +2297,6 @@ declare module "typescript" {
22972297
>referencedFiles : FileReference[]
22982298
>FileReference : FileReference
22992299

2300-
referenceDiagnostics: Diagnostic[];
2301-
>referenceDiagnostics : Diagnostic[]
2302-
>Diagnostic : Diagnostic
2303-
2304-
parseDiagnostics: Diagnostic[];
2305-
>parseDiagnostics : Diagnostic[]
2306-
>Diagnostic : Diagnostic
2307-
2308-
semanticDiagnostics: Diagnostic[];
2309-
>semanticDiagnostics : Diagnostic[]
2310-
>Diagnostic : Diagnostic
2311-
2312-
syntacticDiagnostics: Diagnostic[];
2313-
>syntacticDiagnostics : Diagnostic[]
2314-
>Diagnostic : Diagnostic
2315-
23162300
hasNoDefaultLib: boolean;
23172301
>hasNoDefaultLib : boolean
23182302

@@ -2336,9 +2320,6 @@ declare module "typescript" {
23362320
identifiers: Map<string>;
23372321
>identifiers : Map<string>
23382322
>Map : Map<T>
2339-
2340-
lineMap: number[];
2341-
>lineMap : number[]
23422323
}
23432324
interface ScriptReferenceHost {
23442325
>ScriptReferenceHost : ScriptReferenceHost
@@ -3896,6 +3877,9 @@ declare module "typescript" {
38963877
watch?: boolean;
38973878
>watch : boolean
38983879

3880+
stripInternal?: boolean;
3881+
>stripInternal : boolean
3882+
38993883
[option: string]: string | number | boolean;
39003884
>option : string
39013885
}
@@ -3976,6 +3960,9 @@ declare module "typescript" {
39763960
error?: DiagnosticMessage;
39773961
>error : DiagnosticMessage
39783962
>DiagnosticMessage : DiagnosticMessage
3963+
3964+
experimental?: boolean;
3965+
>experimental : boolean
39793966
}
39803967
const enum CharacterCodes {
39813968
>CharacterCodes : CharacterCodes

tests/baselines/reference/APISample_watcher.js

+2-5
Original file line numberDiff line numberDiff line change
@@ -795,18 +795,13 @@ declare module "typescript" {
795795
amdDependencies: string[];
796796
amdModuleName: string;
797797
referencedFiles: FileReference[];
798-
referenceDiagnostics: Diagnostic[];
799-
parseDiagnostics: Diagnostic[];
800-
semanticDiagnostics: Diagnostic[];
801-
syntacticDiagnostics: Diagnostic[];
802798
hasNoDefaultLib: boolean;
803799
externalModuleIndicator: Node;
804800
nodeCount: number;
805801
identifierCount: number;
806802
symbolCount: number;
807803
languageVersion: ScriptTarget;
808804
identifiers: Map<string>;
809-
lineMap: number[];
810805
}
811806
interface ScriptReferenceHost {
812807
getCompilerOptions(): CompilerOptions;
@@ -1253,6 +1248,7 @@ declare module "typescript" {
12531248
target?: ScriptTarget;
12541249
version?: boolean;
12551250
watch?: boolean;
1251+
stripInternal?: boolean;
12561252
[option: string]: string | number | boolean;
12571253
}
12581254
const enum ModuleKind {
@@ -1283,6 +1279,7 @@ declare module "typescript" {
12831279
description?: DiagnosticMessage;
12841280
paramType?: DiagnosticMessage;
12851281
error?: DiagnosticMessage;
1282+
experimental?: boolean;
12861283
}
12871284
const enum CharacterCodes {
12881285
nullCharacter = 0,

0 commit comments

Comments
 (0)