Skip to content

Commit

Permalink
Merge branch 'remove-suppressImplicitAnyIndexErrors' into bump-typesc…
Browse files Browse the repository at this point in the history
…ript-5.0.4
  • Loading branch information
koizuka committed Apr 23, 2024
2 parents 4719a6f + bd861f9 commit 05b94cb
Show file tree
Hide file tree
Showing 51 changed files with 194 additions and 120 deletions.
4 changes: 4 additions & 0 deletions app/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ const SENTRY_SERVER_URL = getSentryCrashReportUrl(sentryParam);
const windowId = Utils.getWindowId();

function wrapLogFn(fn: string) {
// @ts-expect-error ts7053
const old: Function = console[fn];
// @ts-expect-error ts7053
console[fn] = (...args: any[]) => {
old.apply(console, args);

Expand Down Expand Up @@ -201,6 +203,7 @@ document.addEventListener('DOMContentLoaded', () => {
const appService: AppService = AppService.instance;

// This is used for debugging
// @ts-expect-error ts7053
window['obs'] = obs;

// Host a new OBS server instance
Expand Down Expand Up @@ -292,6 +295,7 @@ document.addEventListener('DOMContentLoaded', () => {
if (windowId === 'child') return h(ChildWindow);
if (windowId === 'main') {
const componentName = windowsService.state[windowId].componentName;
// @ts-expect-error ts7053
return h(windowsService.components[componentName]);
}
return h(OneOffWindow);
Expand Down
2 changes: 2 additions & 0 deletions app/components/ApiSettings.vue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ export default class ApiSettings extends Vue {
const settings: Partial<ITcpServersSettings> = {};
settingsData.forEach(subCategory => {
subCategory.parameters.forEach(parameter => {
// @ts-expect-error ts7053
if (!settings[subCategory.codeSubCategory]) settings[subCategory.codeSubCategory] = {};
// @ts-expect-error ts7053
settings[subCategory.codeSubCategory][parameter.name] = parameter.value;
});
});
Expand Down
1 change: 1 addition & 0 deletions app/components/AppearanceSettings.vue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export default class AppearanceSettings extends Vue {
saveSettings(formData: TObsFormData) {
const settings: Partial<ICustomizationSettings> = {};
formData.forEach(formInput => {
// @ts-expect-error ts7053
settings[formInput.name] = formInput.value;
});
this.customizationService.setSettings(settings);
Expand Down
2 changes: 2 additions & 0 deletions app/components/NotificationsSettings.vue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export default class NotificationsSettings extends Vue {
saveNotificationsSettings(formData: TObsFormData) {
const settings: Partial<INotificationsSettings> = {};
formData.forEach(formInput => {
// @ts-expect-error ts7053
settings[formInput.name] = formInput.value;
});
this.notificationsService.setSettings(settings);
Expand All @@ -32,6 +33,7 @@ export default class NotificationsSettings extends Vue {
saveTroubleshooterSettings(formData: TObsFormData) {
const settings: Partial<ITroubleshooterSettings> = {};
formData.forEach(formInput => {
// @ts-expect-error ts7053
settings[formInput.name] = formInput.value;
});
this.troubleshooterService.setSettings(settings);
Expand Down
12 changes: 6 additions & 6 deletions app/components/SourceSelector.vue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { EditMenu } from '../util/menus/EditMenu';
import SlVueTree, { ISlTreeNode, ISlTreeNodeModel, ICursorPosition } from 'sl-vue-tree';
import { $t } from 'services/i18n';

const sourceIconMap = {
const sourceIconMap: Dictionary<string> = {
ffmpeg_source: 'icon-media',
text_gdiplus: 'icon-text',
text_ft2_source: 'icon-text',
Expand All @@ -30,7 +30,7 @@ const sourceIconMap = {
'decklink-input': 'icon-blackmagic',
vlc_source: 'icon-play',
wasapi_process_output_capture: 'icon-app-speaker',
'nair-rtvc-source': 'icon-speech-engine'
'nair-rtvc-source': 'icon-speech-engine',
};

@Component({
Expand Down Expand Up @@ -110,10 +110,10 @@ export default class SourceSelector extends Vue {
const sceneNode = this.scene.getNode(sceneNodeId);
const menuOptions = sceneNode
? {
selectedSceneId: this.scene.id,
sceneNodeId,
showSceneItemMenu: true,
}
selectedSceneId: this.scene.id,
sceneNodeId,
showSceneItemMenu: true,
}
: { selectedSceneId: this.scene.id };

const menu = new EditMenu(menuOptions);
Expand Down
1 change: 1 addition & 0 deletions app/components/StudioEditor.vue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ export default class StudioEditor extends Vue {
});

const options = {
// @ts-expect-error ts7053
...optionsMap[name],
lockRatio: !event.shiftKey,
};
Expand Down
1 change: 1 addition & 0 deletions app/components/obs/inputs/Components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const inputComponents = comps as any as { [key: string]: typeof TsxComponent };

export function propertyComponentForType(type: TObsType): typeof TsxComponent {
const componentName = Object.keys(inputComponents).find(name => {
// @ts-expect-error ts7053
const componentObsType = inputComponents[name]['obsType'];
return Array.isArray(componentObsType)
? componentObsType.includes(type)
Expand Down
1 change: 1 addition & 0 deletions app/components/obs/inputs/ObsFontInput.vue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class ObsFontInput extends ObsInput<IObsInput<IObsFont>> {
}

setFontType(e: Event) {
// @ts-expect-error ts7053
this.isGoogleFont = e.target['checked'];
}
}
Expand Down
1 change: 1 addition & 0 deletions app/components/obs/inputs/ObsTextInput.vue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class ObsTextInput extends ObsInput<IObsInput<string>> {
}

onInputHandler(event: Event) {
// @ts-expect-error ts7053
this.emitInput({ ...this.value, value: event.target['value'] });
}
}
Expand Down
2 changes: 2 additions & 0 deletions app/components/shared/inputs/BaseInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export class BaseInput<TValueType, TMetadataType extends IInputMetadata> extends

emitInput(eventData: TValueType, event?: any) {
this.$emit('input', eventData, event);
// @ts-expect-error ts7053
if (this.$parent['emitInput']) this.$parent['emitInput'](eventData, event);
}

Expand All @@ -37,6 +38,7 @@ export class BaseInput<TValueType, TMetadataType extends IInputMetadata> extends
Object.keys(validations).forEach(key => {
// VeeValidate recognizes undefined values as valid constraints
// so just remove it
// @ts-expect-error ts7053
if (validations[key] === void 0) delete validations[key];
});
return validations;
Expand Down
1 change: 1 addition & 0 deletions app/components/tsx-component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export function createProps<TProps extends new () => any>(
const propsObj = {};
const props = new propsClass();
Object.keys(props).forEach((key: string) => {
// @ts-expect-error ts7053
propsObj[key] = { default: props[key] };
});
return propsObj;
Expand Down
2 changes: 2 additions & 0 deletions app/components/windows/RtvcSourceProperties.vue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,11 @@ export default class RtvcSourceProperties extends SourceProperties {
setParam(key: SetParamKey, value: any) {
const p = this.indexToNum(this.currentIndex);
if (p.isManual) {
// @ts-expect-error ts7053
this.state.manuals[p.idx][key] = value;
return;
}
// @ts-expect-error ts7053
this.state.presets[p.idx][key] = value;
}

Expand Down
3 changes: 2 additions & 1 deletion app/services-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export class ServicesManager extends Service {
init() {
// this helps to debug services from the console
if (Utils.isDevMode()) {
// @ts-expect-error ts7053
window['sm'] = this;
}

Expand Down Expand Up @@ -71,7 +72,7 @@ export class ServicesManager extends Service {
}

getStatefulServicesAndMutators(): Dictionary<typeof StatefulService> {
const statefulServices = {};
const statefulServices: Dictionary<typeof StatefulService> = {};
Object.keys(this.services).forEach(serviceName => {
const ServiceClass = this.services[serviceName];
const isStatefulService = ServiceClass['initialState'];
Expand Down
2 changes: 1 addition & 1 deletion app/services/api/external-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { InternalApiService } from './internal-api';
import { Service } from 'services/core/service';
import * as traverse from 'traverse';

const apiResources = {};
const apiResources: Dictionary<any> = {};

/**
* A decorator to mark class as a singleton
Expand Down
10 changes: 10 additions & 0 deletions app/services/api/internal-api-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,29 @@ export class InternalApiClient {

return new Proxy(service, {
get: (target, property, receiver) => {
// @ts-expect-error ts7053
if (!target[property]) return target[property];

// @ts-expect-error ts7053
if (target[property]._isHelper) {
// @ts-expect-error ts7053
return this.applyIpcProxy(target[property]);
}

if (Reflect.getMetadata('executeInCurrentWindow', target, property as string)) {
// @ts-expect-error ts7053
return target[property];
}

// @ts-expect-error ts7053
if (typeof target[property] !== 'function' && !(target[property] instanceof Observable)) {
// @ts-expect-error ts7053
return target[property];
}

const serviceName = target.constructor.name;
const methodName = property;
// @ts-expect-error ts7053
const isHelper = target['_isHelper'];

const handler = (...args: any[]) => {
Expand All @@ -74,6 +81,7 @@ export class InternalApiClient {
const response: IJsonRpcResponse<any> = electron.ipcRenderer.sendSync(
'services-request',
this.jsonrpc.createRequestWithOptions(
// @ts-expect-error ts7053
isHelper ? target['_resourceId'] : serviceName,
methodName as string,
{ compactMode: true, fetchMutations: true },
Expand Down Expand Up @@ -124,7 +132,9 @@ export class InternalApiClient {
return result;
};

// @ts-expect-error ts7053
if (typeof target[property] === 'function') return handler;
// @ts-expect-error ts7053
if (target[property] instanceof Observable) return handler();
},
});
Expand Down
4 changes: 3 additions & 1 deletion app/services/api/rpc-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ export abstract class RpcApi extends Service {
this.requestErrors.push(`Resource not found: ${resourceId}`);
return null;
}
const resourceScheme = {};
const resourceScheme: Dictionary<string> = {};

// collect resource keys from the whole prototype chain
const keys: string[] = [];
Expand All @@ -266,7 +266,9 @@ export abstract class RpcApi extends Service {
}

private getResourceModel(helper: Object): Object {
// @ts-expect-error ts7053
if (helper['getModel'] && typeof helper['getModel'] === 'function') {
// @ts-expect-error ts7053
return helper['getModel']();
}
return {};
Expand Down
2 changes: 2 additions & 0 deletions app/services/audio/audio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ export class AudioService extends StatefulService<IAudioSourcesState> implements
const newPatch = omit(patch, 'fader');

Object.keys(newPatch).forEach(name => {
// @ts-expect-error ts7053
const value = newPatch[name];
if (value === void 0) return;

Expand All @@ -239,6 +240,7 @@ export class AudioService extends StatefulService<IAudioSourcesState> implements
} else if (name === 'muted') {
this.sourcesService.setMuted(sourceId, value);
} else {
// @ts-expect-error ts7053
obsInput[name] = value;
}
});
Expand Down
2 changes: 2 additions & 0 deletions app/services/core/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@ export abstract class Service {
serviceName = this.constructor.name;

static get instance() {
// @ts-expect-error ts7053
const instance = !this.hasInstance ? Service.createInstance(this) : this[singleton];
return this.proxyFn ? this.proxyFn(instance) : instance;
}

static get hasInstance(): boolean {
// @ts-expect-error ts7053
return !!instances[this.name];
}

Expand Down
1 change: 1 addition & 0 deletions app/services/core/stateful-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ export function getModule(ModuleContainer: any): Module<any, any> {
for (const mutationName in prototypeMutations) {
const serviceName = mutationName.split('.')[0];
if (serviceName !== ModuleContainer.name) continue;
// @ts-expect-error ts7053
mutations[mutationName] = prototypeMutations[mutationName];
}

Expand Down
2 changes: 2 additions & 0 deletions app/services/dismissables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,12 @@ export class DismissablesService extends PersistentStatefulService<IDismissables
}

dismissAll() {
// @ts-expect-error ts7053
Object.keys(EDismissable).forEach(key => this.dismiss(EDismissable[key]));
}

resetAll() {
// @ts-expect-error ts7053
Object.keys(EDismissable).forEach(key => this.reset(EDismissable[key]));
}

Expand Down
2 changes: 1 addition & 1 deletion app/services/i18n/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export function $t(...args: any[]): string {
/**
* @see https://electronjs.org/docs/api/locales
*/
const LANG_CODE_MAP = {
const LANG_CODE_MAP: Dictionary<{ lang: string; locale?: string }> = {
cs: { lang: 'Czech', locale: 'cs-CZ' },
de: { lang: 'German', locale: 'de-DE' },
'en-US': { lang: 'English', locale: 'en-US' },
Expand Down
10 changes: 5 additions & 5 deletions app/services/nicolive-program/NicoliveClient.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ describe('parseMaxQuality', () => {
height,
fps,
});
}
);
});
});

test('constructor', () => {
Expand Down Expand Up @@ -162,6 +161,7 @@ suites.forEach((suite: Suite) => {
test(`dataを取り出して返す - ${suite.name}`, async () => {
const client = new NicoliveClient();

// @ts-expect-error ts7053
fetchMock[suite.method.toLowerCase()](suite.base + suite.path, dummyBody);
const result = await client[suite.name](...(suite.args || []));

Expand Down Expand Up @@ -251,7 +251,7 @@ function setupMock() {
loadURL(url: string) {
this.url = url;
for (const cb of this.webContentsCallbacks) {
cb({ preventDefault() { } }, url);
cb({ preventDefault() {} }, url);
}
}
close = jest.fn().mockImplementation(() => {
Expand Down Expand Up @@ -284,7 +284,7 @@ function setupMock() {
},
},
ipcRenderer: {
send() { },
send() {},
},
}));

Expand Down Expand Up @@ -437,4 +437,4 @@ describe('webviews', () => {
});
});

// TODO add test for konomiTags, userFollow APIs
// TODO add test for konomiTags, userFollow APIs
Loading

0 comments on commit 05b94cb

Please sign in to comment.