Remove declares in sys, core, evaluatorImpl (#53176)

This commit is contained in:
Jake Bailey 2023-03-10 09:57:32 -08:00 committed by GitHub
parent e7753831e9
commit 42d23390e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 16 deletions

View File

@ -2869,8 +2869,6 @@ function trimEndImpl(s: string) {
return s.slice(0, end + 1);
}
declare const process: any;
/** @internal */
export function isNodeLikeSystem(): boolean {
// This is defined here rather than in sys.ts to prevent a cycle from its
@ -2880,7 +2878,7 @@ export function isNodeLikeSystem(): boolean {
// when bundled using esbuild, this function will be rewritten to `__require`
// and definitely exist.
return typeof process !== "undefined"
&& process.nextTick
&& !process.browser
&& !!process.nextTick
&& !(process as any).browser
&& typeof module === "object";
}

View File

@ -1443,12 +1443,6 @@ interface DirectoryWatcher extends FileWatcher {
referenceCount: number;
}
declare const require: any;
declare const process: any;
declare const global: any;
declare const __filename: string;
declare const __dirname: string;
// TODO: GH#18217 this is used as if it's certainly defined in many places.
export let sys: System = (() => {
// NodeJS detects "\uFEFF" at the start of the string and *replaces* it with the actual
@ -1507,7 +1501,7 @@ export let sys: System = (() => {
getAccessibleSortedChildDirectories: path => getAccessibleFileSystemEntries(path).directories,
realpath,
tscWatchFile: process.env.TSC_WATCHFILE,
useNonPollingWatchers: process.env.TSC_NONPOLLING_WATCHER,
useNonPollingWatchers: !!process.env.TSC_NONPOLLING_WATCHER,
tscWatchDirectory: process.env.TSC_WATCHDIRECTORY,
inodeWatching: isLinuxOrMacOs,
sysLog,
@ -1584,7 +1578,7 @@ export let sys: System = (() => {
disableCPUProfiler,
cpuProfilingEnabled: () => !!activeSession || contains(process.execArgv, "--cpu-prof") || contains(process.execArgv, "--prof"),
realpath,
debugMode: !!process.env.NODE_INSPECTOR_IPC || !!process.env.VSCODE_INSPECTOR_OPTIONS || some(process.execArgv as string[], arg => /^--(inspect|debug)(-brk)?(=\d+)?$/i.test(arg)),
debugMode: !!process.env.NODE_INSPECTOR_IPC || !!process.env.VSCODE_INSPECTOR_OPTIONS || some(process.execArgv, arg => /^--(inspect|debug)(-brk)?(=\d+)?$/i.test(arg)),
tryEnableSourceMapsForHost() {
try {
(require("source-map-support") as typeof import("source-map-support")).install();
@ -1599,8 +1593,9 @@ export let sys: System = (() => {
process.stdout.write("\x1Bc");
},
setBlocking: () => {
if (process.stdout && process.stdout._handle && process.stdout._handle.setBlocking) {
process.stdout._handle.setBlocking(true);
const handle = (process.stdout as any)?._handle as { setBlocking?: (value: boolean) => void };
if (handle && handle.setBlocking) {
handle.setBlocking(true);
}
},
bufferFrom,

View File

@ -5,8 +5,6 @@ import * as ts from "./_namespaces/ts";
import * as vfs from "./_namespaces/vfs";
import * as vpath from "./_namespaces/vpath";
declare let Symbol: SymbolConstructor;
const sourceFile = vpath.combine(vfs.srcFolder, "source.ts");
const sourceFileJs = vpath.combine(vfs.srcFolder, "source.js");