Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/cdp-proxy/debuggerEndpointHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,6 @@ export class DebuggerEndpointHelper {
return false;
}

return buf.equals(this.localv4) || buf.equals(this.localv6);
return buf.equals(this.localv4 as any) || buf.equals(this.localv6 as any);
}
}
2 changes: 1 addition & 1 deletion src/common/error/errorHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export class ErrorHelper {

private static getErrorMessage(errorCode: InternalErrorCode, ...optionalArgs: any[]): string {
return ErrorHelper.formatErrorMessage(
ErrorHelper.ERROR_STRINGS[errorCode],
ErrorHelper.ERROR_STRINGS[errorCode as keyof typeof ErrorHelper.ERROR_STRINGS],
...optionalArgs,
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/common/packager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ export class Packager {
projectRoot,
);
Object.keys(packagerOptions).forEach(key => {
args = args.concat([`--${key}`, packagerOptions[key]]);
args = args.concat([`--${key}`, (packagerOptions as any)[key]]);
});
} catch (error) {
this.logger.warning(
Expand Down
2 changes: 1 addition & 1 deletion src/common/projectVersionHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export function RNPackageVersionsToPackageVersion(
const res: PackageVersion[] = [];
Object.keys(packageVersions).forEach(key => {
const item: PackageVersion = {};
item[key] = packageVersions[key];
item[key] = (packageVersions as any)[key];
res.push(item);
});
return res;
Expand Down
5 changes: 4 additions & 1 deletion src/debugger/appWorker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,10 @@ function fetch(url) {
* https://github.com/facebook/react-native/blob/588f01e9982775f0699c7bfd56623d4ed3949810/local-cli/server/util/webSocketProxy.js#L38
*/
const msgKey = "_closeMessage";
if (this.socketToApp[msgKey] === "Another debugger is already connected") {
if (
(this.socketToApp as any)[msgKey] ===
"Another debugger is already connected"
) {
reject(
ErrorHelper.getInternalError(
InternalErrorCode.AnotherDebuggerConnectedToPackager,
Expand Down
6 changes: 4 additions & 2 deletions src/debugger/debugSessionBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,11 @@ export abstract class DebugSessionBase extends LoggingDebugSession {
let logLevel: string = args.trace;
if (logLevel) {
logLevel = logLevel.replace(logLevel[0], logLevel[0].toUpperCase());
logger.setup(Logger.LogLevel[logLevel], chromeDebugCoreLogs || false);
logger.setup((Logger.LogLevel as any)[logLevel], chromeDebugCoreLogs || false);
this.cdpProxyLogLevel =
LogLevel[logLevel] === LogLevel.Verbose ? LogLevel.Custom : LogLevel.None;
(LogLevel as any)[logLevel] === LogLevel.Verbose
? LogLevel.Custom
: LogLevel.None;
} else {
logger.setup(Logger.LogLevel.Log, chromeDebugCoreLogs || false);
this.cdpProxyLogLevel =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export class ReactNativeDebugDynamicConfigProvider implements vscode.DebugConfig
folder: vscode.WorkspaceFolder | undefined,
config: vscode.DebugConfiguration,
token?: vscode.CancellationToken,
): Promise<vscode.ProviderResult<vscode.DebugConfiguration>> {
): Promise<vscode.DebugConfiguration | null | undefined> {
if (config.isDynamic) {
const chosenConfigsEvent = TelemetryHelper.createTelemetryEvent(
"chosenDynamicDebugConfiguration",
Expand Down
2 changes: 1 addition & 1 deletion src/extension/exponent/exponentHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ require('${entryPoint}');`;

private async getFromExpConfig<T>(key: string): Promise<T> {
const config = await this.getExpConfig();
return config[key];
return (config as any)[key];
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/extension/generalPlatform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ export class GeneralPlatform {
) {
value = value.replace(/\\n/gm, "\n");
}
result[key] = value.replace(/(^["']|["']$)/g, "");
(result as any)[key] = value.replace(/(^["']|["']$)/g, "");
}
});

Expand Down
4 changes: 2 additions & 2 deletions src/extension/networkInspector/views/inspectorConsoleView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ export class InspectorConsoleView extends InspectorView {
};

if (url.search) {
networkRequestConsoleView.networkRequestData["Request Query Parameters"] =
(networkRequestConsoleView.networkRequestData as any)["Request Query Parameters"] =
this.retrieveURLSearchParams(url.searchParams);
}

Expand All @@ -239,7 +239,7 @@ export class InspectorConsoleView extends InspectorView {
return headers.reduce((headersViewObject, header) => {
headersViewObject[header.key] = header.value;
return headersViewObject;
}, {});
}, {} as Record<string, string>);
}

private printNetworkRequestData(networkRequestData: ConsoleNetworkRequestDataView): void {
Expand Down
2 changes: 1 addition & 1 deletion src/extension/rn-extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ function activateCommands(): void {
}

function onFolderRemoved(folder: vscode.WorkspaceFolder): void {
const appLauncher = ProjectsStorage.getFolder(folder);
const appLauncher = ProjectsStorage.getFolder(folder) as any;
Object.keys(appLauncher).forEach(key => {
if (appLauncher[key].dispose) {
appLauncher[key].dispose();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -394,19 +394,19 @@ export class TipNotificationService implements vscode.Disposable {
}

private getGeneralTipNotificationTextByKey(key: string): string {
return tipsStorage.generalTips[key].text;
return (tipsStorage.generalTips as any)[key].text;
}

private getSpecificTipNotificationTextByKey(key: string): string {
return tipsStorage.specificTips[key].text;
return (tipsStorage.specificTips as any)[key].text;
}

private getGeneralTipNotificationAnchorLinkByKey(key: string): string {
return tipsStorage.generalTips[key].anchorLink;
return (tipsStorage.generalTips as any)[key].anchorLink;
}

private getSpecificTipNotificationAnchorLinkByKey(key: string): string {
return tipsStorage.specificTips[key].anchorLink;
return (tipsStorage.specificTips as any)[key].anchorLink;
}

private deleteOutdatedKnownDate(): void {
Expand Down
2 changes: 1 addition & 1 deletion src/extension/settingsHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export class SettingsHelper {
const consoleLogsColorTheme: string = ConfigurationReader.readString(
workspaceConfiguration.get("consoleLogsColorTheme"),
);
return SystemColorTheme[consoleLogsColorTheme];
return (SystemColorTheme as any)[consoleLogsColorTheme];
}
return SystemColorTheme.Light;
}
Expand Down
2 changes: 1 addition & 1 deletion test/extension/checkEnvironment.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ suite("checkEnvironment", function () {
};
const restoreEnv = () => {
Object.keys(envVars).forEach(it => {
process.env[it] = envVars[it];
process.env[it] = (envVars as any)[it];
});
};

Expand Down
2 changes: 1 addition & 1 deletion test/extension/mobileTargetManager.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ suite("MobileTargetManager", function () {
items: string[] | Thenable<string[]> | QuickPickItem[] | Thenable<QuickPickItem[]>,
) => {
targetsForSelection = <string[]>await items;
return items[0];
return (items as any)[0];
},
);
targetsForSelection = [];
Expand Down
18 changes: 14 additions & 4 deletions test/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ async function loadGlob(): Promise<any> {
}

function setupCoverage(): NYCPackage {
// eslint-disable-next-line @typescript-eslint/no-var-requires
const NYC = require("nyc");
const nyc = new NYC({
cwd: path.join(__dirname, ".."),
Expand Down Expand Up @@ -75,22 +76,30 @@ export async function run(): Promise<void> {

const testsRoot = __dirname;
const globPkg = await loadGlob();

// Cross-version glob: supports glob v11 Promise API and glob v7 callback API
const getTestFiles = (pattern: string, cwd: string): Promise<string[]> => {
const candidateFns: any[] = [];
if (globPkg) {
if (typeof globPkg.glob === "function") candidateFns.push(globPkg.glob);
if (typeof globPkg === "function") candidateFns.push(globPkg);
if (typeof globPkg.glob === "function") {
candidateFns.push(globPkg.glob);
}
if (typeof globPkg === "function") {
candidateFns.push(globPkg);
}
}

for (const fn of candidateFns) {
try {
const res = fn(pattern, { cwd });
if (res && typeof res.then === "function") {
return res as Promise<string[]>;
return res as Promise<string[]>; // glob >= 11 Promise API
}
} catch (_e) {
// ignore and fallback to callback path
}
}

return new Promise<string[]>((resolve, reject) => {
const cb = (err: Error | null, files: string[]) => (err ? reject(err) : resolve(files));
for (const fn of candidateFns) {
Expand All @@ -107,9 +116,10 @@ export async function run(): Promise<void> {

// Exclude smoke test bundle and localization driver; only run unit/integration tests here
return getTestFiles("extension/**/*.test.js", testsRoot)
.then(files => files.filter(f => !/[/\\]exponent[/\\]/i.test(f)))
.then(files => files.filter(f => !/[\\/]exponent[\\/]/i.test(f)))
.then(files => {
files.forEach(f => mocha.addFile(path.resolve(testsRoot, f)));

return new Promise<void>((resolve, reject) => {
try {
mocha.run(failures => {
Expand Down
1 change: 0 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"alwaysStrict": true,
"strictNullChecks": true,
"noImplicitAny": true,
"suppressImplicitAnyIndexErrors": true,
"ignoreDeprecations": "5.0",
"noImplicitThis": true,
"noImplicitReturns": true,
Expand Down