Skip to content

CFA doesn't work with generic constraint type #30316

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
cevek opened this issue Mar 11, 2019 · 1 comment
Closed

CFA doesn't work with generic constraint type #30316

cevek opened this issue Mar 11, 2019 · 1 comment
Labels
Duplicate An existing issue was already created

Comments

@cevek
Copy link

cevek commented Mar 11, 2019

TypeScript Version: 3.4.0-dev.20190307

Search Terms:

Code

function foo<K extends 'a' | 'b'>(k: K) {
  if (k === 'a') {
     const x: 'a' = k; // Type 'K' is not assignable to type '"a"
  }
}

Expected behavior:

Actual behavior:

Playground Link:

Related Issues:

@jack-williams
Copy link
Collaborator

Related: #20375

@RyanCavanaugh RyanCavanaugh added the Duplicate An existing issue was already created label Mar 12, 2019
@cevek cevek closed this as completed Mar 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

3 participants