Skip to content

can't find name const in latest typescript #48462

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

Closed
tjx666 opened this issue Mar 28, 2022 · 2 comments · Fixed by #48464
Closed

can't find name const in latest typescript #48462

tjx666 opened this issue Mar 28, 2022 · 2 comments · Fixed by #48464
Assignees
Labels
Bug A bug in TypeScript

Comments

@tjx666
Copy link

tjx666 commented Mar 28, 2022

typescript: 4.7.0-dev.20220327
vscode: 1.66.0-insider

image

reproduce:

  1. install extension JavaScript and TypeScript Nightly
  2. toggle to latest typescript
  3. copy following code
  4. restart vscode
class Tex {
    type = 'Text' as const;
}

class Svg {
    type = 'Svg' as const;
}

const map = {
    text: Tex,
    svg: Svg
}

type M = typeof map;

export function bar<T extends keyof M>(type: T): M[T] {
    const s =  map[type];
    return s;
}

const cons = bar('text');
const a = new cons();
const t = s.type;
@exbotanical
Copy link

I'm seeing this as well. Temporary fix is to change the version via the command palette (works for me with 4.6.3).

@mjbvz mjbvz transferred this issue from microsoft/vscode Mar 28, 2022
@mjbvz mjbvz removed their assignment Mar 28, 2022
@RyanCavanaugh
Copy link
Member

Bisected to #36747

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants