Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Narrow doesn't work on class properties #211

Closed
DetachHead opened this issue Mar 4, 2021 · 0 comments
Closed

Narrow doesn't work on class properties #211

DetachHead opened this issue Mar 4, 2021 · 0 comments
Labels
works as intended It works this way

Comments

@DetachHead
Copy link

DetachHead commented Mar 4, 2021

馃悶 Bug Report

Describe the bug

Narrow doesn't work on class properties

Reproduce the bug

interface Foo {
    bar: Narrow<{hi: 'there'}>
}

class Bar implements Foo {
    bar = {hi: 'there'} //error: Type 'string' is not assignable to type 'NarrowRaw<"there">'.
}

Expected behavior

the value of bar is narrowed to type {hi: 'there'}

Screenshots

image

Additional context

ts-toolbelt 9.5.3
typescript 4.2.0

@millsp millsp added the works as intended It works this way label Mar 4, 2021
@millsp millsp closed this as completed Mar 4, 2021
Repository owner locked and limited conversation to collaborators Mar 4, 2021

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
works as intended It works this way
Projects
None yet
Development

No branches or pull requests

2 participants