Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: upgrade typescript #5129

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open
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
19 changes: 14 additions & 5 deletions app/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ for (let i = 0; i < styleSheets.length; i++) {
}
}

function wrapLogFn(fn: string) {
function wrapLogFn(fn: 'debug' | 'error' | 'info' | 'log') {
const old: Function = console[fn];
console[fn] = (...args: any[]) => {
old.apply(console, args);
Expand Down Expand Up @@ -101,9 +101,18 @@ window.addEventListener('unhandledrejection', e => {

// Remove the startup event listener that catches bundle parse errors and other
// critical issues starting up the renderer.
if (window['_startupErrorHandler']) {
window.removeEventListener('error', window['_startupErrorHandler']);
delete window['_startupErrorHandler'];
declare global {
interface Window {
_startupErrorHandler: EventListenerOrEventListenerObject | undefined;
}
}

// TODO: can't find `_startupErrorHandler` in electron or chromium sources
// This might no longer be relevant, we should breakpoint below and see if
// it exists.
if (window._startupErrorHandler) {
window.removeEventListener('error', window._startupErrorHandler);
delete window._startupErrorHandler;
}

// Used by Eddy for debugging on mac.
Expand Down Expand Up @@ -288,7 +297,7 @@ document.addEventListener('DOMContentLoaded', async () => {
const obsUserPluginsService: ObsUserPluginsService = ObsUserPluginsService.instance;

// This is used for debugging
window['obs'] = obs;
(window as typeof window & { obs: typeof obs }).obs = obs;

// Host a new OBS server instance
obs.IPC.host(remote.process.env.IPC_UUID);
Expand Down
5 changes: 4 additions & 1 deletion app/components-react/editor/elements/mixer/GLVolmeters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,10 @@ class GLVolmetersController {
}

beforeDestroy() {
if (this.gl) window['activeWebglContexts'] -= 1;
if (this.gl) {
// TODO: where is this defined or used, can be undefined too?
(window as typeof window & { activeWebglContexts: number })['activeWebglContexts'] -= 1;
}
clearInterval(this.canvasWidthInterval);
// unsubscribe all volmeters
Object.keys(this.subscriptions).forEach(sourceId => this.unsubscribeVolmeter(sourceId));
Expand Down
12 changes: 10 additions & 2 deletions app/components-react/editor/layouts/Classic.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ export function Classic(p: React.PropsWithChildren<LayoutProps>) {
return (
<div className={styles.rows} ref={componentRef}>
<div className={styles.cell} style={{ height: `${100 - resizes.bar1 * 100}%` }}>
{p.children?.['1'] || <></>}
{
// TODO: index
// @ts-ignore
p.children?.['1'] || <></>
}
</div>
<ResizeBar
position="top"
Expand All @@ -30,7 +34,11 @@ export function Classic(p: React.PropsWithChildren<LayoutProps>) {
>
{['2', '3', '4'].map(slot => (
<div key={slot} className={cx(styles.cell, 'no-top-padding')}>
{p.children?.[slot] || <></>}
{
// TODO: index
// @ts-ignore
p.children?.[slot] || <></>
}
</div>
))}
</div>
Expand Down
18 changes: 15 additions & 3 deletions app/components-react/editor/layouts/Default.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ export function Default(p: React.PropsWithChildren<LayoutProps>) {
className={styles.cell}
style={{ height: `${100 - (resizes.bar1 + resizes.bar2!) * 100}%` }}
>
{p.children?.['1'] || <></>}
{
// TODO: index
// @ts-ignore
p.children?.['1'] || <></>
}
</div>
<ResizeBar
position="top"
Expand All @@ -32,7 +36,11 @@ export function Default(p: React.PropsWithChildren<LayoutProps>) {
style={{ height: `${resizes.bar1 * 100}%` }}
className={cx(styles.cell, 'no-top-padding')}
>
{p.children?.['2'] || <></>}
{
// TODO: index
// @ts-ignore
p.children?.['2'] || <></>
}
</div>
</ResizeBar>
<ResizeBar
Expand All @@ -48,7 +56,11 @@ export function Default(p: React.PropsWithChildren<LayoutProps>) {
>
{['3', '4', '5'].map(slot => (
<div key={slot} className={cx(styles.cell, 'no-top-padding')}>
{p.children?.[slot] || <></>}
{
// TODO: index
// @ts-ignore
p.children?.[slot] || <></>
}
</div>
))}
</div>
Expand Down
38 changes: 33 additions & 5 deletions app/components-react/editor/layouts/FourByFour.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ export function FourByFour(p: React.PropsWithChildren<LayoutProps>) {
className={styles.cell}
style={{ height: `${100 - (resizes.bar1 + resizes.bar2) * 100}%` }}
>
{p.children?.['1'] || <></>}
{
// TODO: index
// @ts-ignore
p.children?.['1'] || <></>
}
</div>
<ResizeBar
position="top"
Expand All @@ -28,8 +32,20 @@ export function FourByFour(p: React.PropsWithChildren<LayoutProps>) {
min={mins.bar1}
>
<div className={styles.segmented} style={{ height: `${resizes.bar1 * 100}%` }}>
<div className={cx(styles.cell, 'no-top-padding')}>{p.children?.['2'] || <></>}</div>
<div className={cx(styles.cell, 'no-top-padding')}>{p.children?.['3'] || <></>}</div>
<div className={cx(styles.cell, 'no-top-padding')}>
{
// TODO: index
// @ts-ignore
p.children?.['2'] || <></>
}
</div>
<div className={cx(styles.cell, 'no-top-padding')}>
{
// TODO: index
// @ts-ignore
p.children?.['3'] || <></>
}
</div>
</div>
</ResizeBar>
<ResizeBar
Expand All @@ -43,8 +59,20 @@ export function FourByFour(p: React.PropsWithChildren<LayoutProps>) {
className={styles.segmented}
style={{ height: `${resizes.bar2 * 100}%`, padding: '0 8px' }}
>
<div className={cx(styles.cell, 'no-top-padding')}>{p.children?.['4'] || <></>}</div>
<div className={cx(styles.cell, 'no-top-padding')}>{p.children?.['5'] || <></>}</div>
<div className={cx(styles.cell, 'no-top-padding')}>
{
// TODO: index
// @ts-ignore
p.children?.['4'] || <></>
}
</div>
<div className={cx(styles.cell, 'no-top-padding')}>
{
// TODO: index
// @ts-ignore
p.children?.['5'] || <></>
}
</div>
</div>
</ResizeBar>
</div>
Expand Down
36 changes: 31 additions & 5 deletions app/components-react/editor/layouts/OnePane.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,43 @@ export function OnePane(p: React.PropsWithChildren<LayoutProps>) {
min={mins.bar1}
>
<div style={{ width: `${100 - resizes.bar1 * 100}%` }} className={styles.cell}>
{p.children?.['2'] || <></>}
{
// TODO: index
// @ts-ignore
p.children?.['2'] || <></>
}
</div>
</ResizeBar>
<div className={styles.rows} style={{ width: `${resizes.bar1 * 100}%`, paddingTop: '16px' }}>
<div className={styles.cell} style={{ height: '100%' }}>
{p.children?.['1'] || <></>}
{
// TODO: index
// @ts-ignore
p.children?.['1'] || <></>
}
</div>
<div className={styles.segmented}>
<div className={styles.cell}>{p.children?.['3'] || <></>}</div>
<div className={styles.cell}>{p.children?.['4'] || <></>}</div>
<div className={styles.cell}>{p.children?.['5'] || <></>}</div>
<div className={styles.cell}>
{
// TODO: index
// @ts-ignore
p.children?.['3'] || <></>
}
</div>
<div className={styles.cell}>
{
// TODO: index
// @ts-ignore
p.children?.['4'] || <></>
}
</div>
<div className={styles.cell}>
{
// TODO: index
// @ts-ignore
p.children?.['5'] || <></>
}
</div>
</div>
</div>
</div>
Expand Down
36 changes: 31 additions & 5 deletions app/components-react/editor/layouts/OnePaneR.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,34 @@ export function OnePaneR(p: React.PropsWithChildren<LayoutProps>) {
style={{ width: `${100 - resizes.bar1 * 100}%`, paddingTop: '16px' }}
>
<div className={styles.cell} style={{ height: '100%' }}>
{p.children?.['1'] || <></>}
{
// TODO: index
// @ts-ignore
p.children?.['1'] || <></>
}
</div>
<div className={styles.segmented}>
<div className={styles.cell}>{p.children?.['3'] || <></>}</div>
<div className={styles.cell}>{p.children?.['4'] || <></>}</div>
<div className={styles.cell}>{p.children?.['5'] || <></>}</div>
<div className={styles.cell}>
{
// TODO: index
// @ts-ignore
p.children?.['3'] || <></>
}
</div>
<div className={styles.cell}>
{
// TODO: index
// @ts-ignore
p.children?.['4'] || <></>
}
</div>
<div className={styles.cell}>
{
// TODO: index
// @ts-ignore
p.children?.['5'] || <></>
}
</div>
</div>
</div>
<ResizeBar
Expand All @@ -35,7 +57,11 @@ export function OnePaneR(p: React.PropsWithChildren<LayoutProps>) {
min={mins.bar1}
>
<div style={{ width: `${resizes.bar1 * 100}%` }} className={styles.cell}>
{p.children?.['2'] || <></>}
{
// TODO: index
// @ts-ignore
p.children?.['2'] || <></>
}
</div>
</ResizeBar>
</div>
Expand Down
12 changes: 10 additions & 2 deletions app/components-react/editor/layouts/Pyramid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ export function Pyramid(p: React.PropsWithChildren<LayoutProps>) {
return (
<div className={styles.rows} ref={componentRef}>
<div className={styles.cell} style={{ height: `${100 - resizes.bar1 * 100}%` }}>
{p.children?.['1'] || <></>}
{
// TODO: index
// @ts-ignore
p.children?.['1'] || <></>
}
</div>
<ResizeBar
position="top"
Expand All @@ -30,7 +34,11 @@ export function Pyramid(p: React.PropsWithChildren<LayoutProps>) {
>
{['2', '3'].map(slot => (
<div className={cx(styles.cell, 'no-top-padding')} key={slot}>
{p.children?.[slot] || <></>}
{
// TODO: index
// @ts-ignore
p.children?.[slot] || <></>
}
</div>
))}
</div>
Expand Down
18 changes: 15 additions & 3 deletions app/components-react/editor/layouts/Triplets.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,23 @@ export function Triplets(p: React.PropsWithChildren<LayoutProps>) {
>
{['1', '4'].map(slot => (
<div key={slot} className={styles.cell}>
{p.children?.[slot] || <></>}
{
// TODO: index
// @ts-ignore
p.children?.[slot] || <></>
}
</div>
))}
</div>
</ResizeBar>
<div className={styles.stacked} style={{ width: `${resizes.bar1 * 100}%` }}>
{['2', '5'].map(slot => (
<div key={slot} className={styles.cell}>
{p.children?.[slot] || <></>}
{
// TODO: index
// @ts-ignore
p.children?.[slot] || <></>
}
</div>
))}
</div>
Expand All @@ -54,7 +62,11 @@ export function Triplets(p: React.PropsWithChildren<LayoutProps>) {
<div className={styles.stacked} style={{ width: `${resizes.bar2 * 100}%` }}>
{['3', '6'].map(slot => (
<div key={slot} className={styles.cell}>
{p.children?.[slot] || <></>}
{
// TODO: index
// @ts-ignore
p.children?.[slot] || <></>
}
</div>
))}
</div>
Expand Down
34 changes: 29 additions & 5 deletions app/components-react/editor/layouts/TwoPane.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,36 @@ export function TwoPane(p: React.PropsWithChildren<LayoutProps>) {
style={{ width: `${100 - (resizes.bar1 + resizes.bar2) * 100}%` }}
className={styles.cell}
>
{p.children?.['2'] || <></>}
{
// TODO: index
// @ts-ignore
p.children?.['2'] || <></>
}
</div>
</ResizeBar>
<div className={styles.rows} style={{ width: `${resizes.bar1 * 100}%`, paddingTop: '16px' }}>
<div style={{ height: '100%' }} className={styles.cell}>
{p.children?.['1'] || <></>}
{
// TODO: index
// @ts-ignore
p.children?.['1'] || <></>
}
</div>
<div className={styles.segmented}>
<div className={styles.cell}>{p.children?.['3'] || <></>}</div>
<div className={styles.cell}>{p.children?.['4'] || <></>}</div>
<div className={styles.cell}>
{
// TODO: index
// @ts-ignore
p.children?.['3'] || <></>
}
</div>
<div className={styles.cell}>
{
// TODO: index
// @ts-ignore
p.children?.['4'] || <></>
}
</div>
</div>
</div>
<ResizeBar
Expand All @@ -46,7 +66,11 @@ export function TwoPane(p: React.PropsWithChildren<LayoutProps>) {
transformScale={1}
>
<div style={{ width: `${resizes.bar2 * 100}%` }} className={styles.cell}>
{p.children?.['5'] || <></>}
{
// TODO: index
// @ts-ignore
p.children?.['5'] || <></>
}
</div>
</ResizeBar>
</div>
Expand Down
Loading
Loading