Skip to content

Type system: Way to say I want a value type #888

Description

Right now you can say a string which will accept any string literal("abc") or the string type itself. There is many cases where you'd actually want it to only be allowed to receive a value(string literal in this case).

Maybe we can have something like

model Foo<T extends string & value> {}

// or
model Foo<T extends valueof(string)>

Proposal https://gist.github.com/timotheeguerin/56214ebb131722a9c88a8bdb74a112b1

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

design:neededA design request has been raised that needs a proposal

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions