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

[Bug] getInst() function is getting mis-optimized for a worker with rollup #302

Closed
nev21 opened this issue Jul 29, 2024 · 0 comments
Closed
Labels
bug Something isn't working published-npm
Milestone

Comments

@nev21
Copy link
Contributor

nev21 commented Jul 29, 2024

The getInst() function is getting mis-optimized via rollup / karma for worker tests in another (as yet) unpublished project (ts-debug)

function getInst(name, useCached) {
    if (name === WINDOW) {
        return getWindow();
    }
    return NULL_VALUE;
}

from

export function getInst<T>(name: string | number | symbol, useCached?: boolean): T | null {
    const gbl = (!_cachedGlobal || useCached === false) ? getGlobal(useCached) : _cachedGlobal.v;
    if (gbl && gbl[name]) {
        return gbl[name] as T;
    }

    // Test workaround, for environments where <global>.window (when global == window) doesn't return the base window
    if (name === WINDOW) {
        // tslint:disable-next-line: no-angle-bracket-type-assertion
        return <any>getWindow() as T;
    }

    return NULL_VALUE;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working published-npm
Projects
None yet
Development

No branches or pull requests

1 participant