MCPcopy Create free account
hub / github.com/Snapchat/Valdi / initialize

Method initialize

compiler/companion/src/Workspace.ts:139–157  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

137 this.scheduleFlushOpenQueuedFiles = flushOpenQueuedFiles;
138 }
139 }
140
141 initialize(): void {
142 const tsConfigCompilerOptions = this.project.compilerOptions;
143 // Doing this to make sure we automatically "open" any files referred to in
144 // tsconfig.compilerOptions.types _if they are present_.
145 //
146 // Note: we seem to be using tsconfig.compilerOptions.types in a _very_
147 // unexpected way (see docs: https://www.typescriptlang.org/tsconfig#types)
148 //
149 // It seems likely that the fact that this lets us make Long.d.ts available globally
150 // is accidental.
151 const typesFiles = tsConfigCompilerOptions.types ?? [];
152 const basePath = (tsConfigCompilerOptions.typeRoots ?? [''])[0];
153 const presentTypesFiles = typesFiles
154 .map((unresolvedTypesFilePath) => path.resolve(basePath, unresolvedTypesFilePath + '.d.ts'))
155 .filter((f) => this.project.fileExists(f));
156
157 presentTypesFiles.forEach((typesFilePath) => this.doOpenFile(typesFilePath));
158 this.initialized = true;
159 }
160

Callers

nothing calls this directly

Calls 6

doOpenFileMethod · 0.95
filterMethod · 0.80
resolveMethod · 0.65
forEachMethod · 0.65
mapMethod · 0.45
fileExistsMethod · 0.45

Tested by

no test coverage detected