Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

can't find name const in latest typescript #48462

Copy link
Copy link
@tjx666

Description

@tjx666
Issue body actions

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;
Reactions are currently unavailable

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptA bug in TypeScript

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.