debt - typecheck our top level JS files (#166844) (#200007)

* debt - typecheck our top level JS files (#166844)

* fix build
This commit is contained in:
Benjamin Pasero 2023-12-05 09:18:57 +01:00 committed by GitHub
parent de6b1990e8
commit 38518f236e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 33 additions and 5 deletions

View file

@ -56,6 +56,9 @@ function pipeLoggingToParent() {
* @param {ArrayLike<unknown>} args
*/
function safeToArray(args) {
/**
* @type {string[]}
*/
const seen = [];
const argsArray = [];
@ -178,7 +181,7 @@ function pipeLoggingToParent() {
Object.defineProperty(stream, 'write', {
set: () => { },
get: () => (chunk, encoding, callback) => {
get: () => (/** @type {string | Buffer | Uint8Array} */ chunk, /** @type {BufferEncoding | undefined} */ encoding, /** @type {((err?: Error | undefined) => void) | undefined} */ callback) => {
buf += chunk.toString(encoding);
const eol = buf.length > MAX_STREAM_BUFFER_LENGTH ? buf.length : buf.lastIndexOf('\n');
if (eol !== -1) {
@ -239,7 +242,9 @@ function configureCrashReporter() {
const crashReporterProcessType = process.env['VSCODE_CRASH_REPORTER_PROCESS_TYPE'];
if (crashReporterProcessType) {
try {
// @ts-ignore
if (process['crashReporter'] && typeof process['crashReporter'].addExtraParameter === 'function' /* Electron only */) {
// @ts-ignore
process['crashReporter'].addExtraParameter('processType', crashReporterProcessType);
}
} catch (error) {

View file

@ -20,6 +20,7 @@
// Browser
else {
// @ts-ignore
globalThis.MonacoBootstrapWindow = factory();
}
}(this, function () {
@ -71,12 +72,16 @@
};
const isDev = !!safeProcess.env['VSCODE_DEV'];
const enableDeveloperKeybindings = isDev || forceEnableDeveloperKeybindings;
/**
* @type {() => void | undefined}
*/
let developerDeveloperKeybindingsDisposable;
if (enableDeveloperKeybindings) {
developerDeveloperKeybindingsDisposable = registerDeveloperKeybindings(disallowReloadKeybinding);
}
// Get the nls configuration into the process.env as early as possible
// @ts-ignore
const nlsConfig = globalThis.MonacoBootstrap.setupNLS();
let locale = nlsConfig.availableLanguages['*'] || 'en';
@ -90,6 +95,10 @@
window['MonacoEnvironment'] = {};
/**
* @typedef {any} LoaderConfig
*/
/** @type {LoaderConfig} */
const loaderConfig = {
baseUrl: `${bootstrapLib.fileUriFromPath(configuration.appRoot, { isWindows: safeProcess.platform === 'win32', scheme: 'vscode-file', fallbackAuthority: 'vscode-app' })}/out`,
'vs/nls': nlsConfig,

View file

@ -513,6 +513,7 @@ function registerListeners() {
* @type {string[]}
*/
const macOpenFiles = [];
// @ts-ignore
global['macOpenFiles'] = macOpenFiles;
app.on('open-file', function (event, path) {
macOpenFiles.push(path);
@ -539,6 +540,7 @@ function registerListeners() {
app.on('open-url', onOpenUrl);
});
// @ts-ignore
global['getOpenUrls'] = function () {
app.removeListener('open-url', onOpenUrl);

View file

@ -25,7 +25,13 @@
"include": [
"./bootstrap.js",
"./bootstrap-amd.js",
"./bootstrap-fork.js",
"./bootstrap-node.js",
"./bootstrap-window.js",
"./cli.js",
"./main.js",
"./server-main.js",
"./server-cli.js",
"./typings",
"./vs/**/*.ts",
"vscode-dts/vscode.proposed.*.d.ts",

View file

@ -14,6 +14,7 @@
"vs/workbench/services/keybinding/test/node/keyboardMapperTestUtils.ts"
],
"ban-trustedtypes-createpolicy": [
"bootstrap-window.js",
"vs/amdX.ts",
"vs/base/browser/trustedTypes.ts",
"vs/base/worker/workerMain.ts",

View file

@ -226,8 +226,11 @@ export type IFileContentCondition = (IFileLanguageCondition | IFilePathCondition
export interface IAppCenterConfiguration {
readonly 'win32-x64': string;
readonly 'win32-arm64': string;
readonly 'linux-x64': string;
readonly 'darwin': string;
readonly 'darwin-universal': string;
readonly 'darwin-arm64': string;
}
export interface IConfigBasedExtensionTip {

View file

@ -115,6 +115,7 @@ export interface NativeParsedArgs {
'profile'?: string;
'profile-temp'?: boolean;
'disable-chromium-sandbox'?: boolean;
sandbox?: boolean;
'enable-coi'?: boolean;

View file

@ -121,6 +121,7 @@ export const OPTIONS: OptionDescriptions<Required<NativeParsedArgs>> = {
'inspect-brk-extensions': { type: 'string', allowEmptyValue: true, deprecates: ['debugBrkPluginHost'], args: 'port', cat: 't', description: localize('inspect-brk-extensions', "Allow debugging and profiling of extensions with the extension host being paused after start. Check the developer tools for the connection URI.") },
'disable-gpu': { type: 'boolean', cat: 't', description: localize('disableGPU', "Disable GPU hardware acceleration.") },
'disable-chromium-sandbox': { type: 'boolean', cat: 't', description: localize('disableChromiumSandbox', "Use this option only when there is requirement to launch the application as sudo user on Linux or when running as an elevated user in an applocker environment on Windows.") },
'sandbox': { type: 'boolean' },
'ms-enable-electron-run-as-node': { type: 'boolean', global: true },
'telemetry': { type: 'boolean', cat: 't', description: localize('telemetry', "Shows all telemetry events which VS code collects.") },

View file

@ -112,13 +112,13 @@ suite('parseArgs', () => {
_: string[];
}
const options1: OptionDescriptions<TestArgs1> = {
const options1 = {
'testcmd': c('A test command', {
testArg: o('A test command option'),
_: { type: 'string[]' }
}),
_: { type: 'string[]' }
};
} satisfies OptionDescriptions<TestArgs1>;
assertParse(
options1,
['testcmd', '--testArg=foo'],
@ -142,13 +142,13 @@ suite('parseArgs', () => {
_: string[];
}
const options2: OptionDescriptions<TestArgs2> = {
const options2 = {
'testcmd': c('A test command', {
testArg: o('A test command option')
}),
testX: { type: 'boolean', global: true, description: '' },
_: { type: 'string[]' }
};
} satisfies OptionDescriptions<TestArgs2>;
assertParse(
options2,
['testcmd', '--testArg=foo', '--testX'],