microsoft / microsoft/TypeScript
PropertyDecorator factory with generic type is not so intelligent
Aperta
@rbuckton ci sta già lavorando.
Dal 26/6/2019.
Needs Investigation
- Lingua principale
- Go
- Stelle
- 111k
- Fork
- 14.4k
- Merge medio
- 1g 19h
- PR unite (30g)
- 117
Descrizione
TypeScript Version: 3.5.1
Search Terms:
Code
export const Reactive = <T, K extends keyof T>(
setter?: (this: T, value?: T[K]) => boolean | void,
) => (target: T, propertyKey: K) => {
// do something
};
class Test {
@Reactive(function(name) {
// error
})
name: string
}
Expected behavior:
Automatically detect this should be type of Test, and name should be type of string
Actual behavior:
Argument of type '"name"' is not assignable to parameter of type 'never'.
Playground Link:
Playground Link
Related Issues:
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Valutazione
Questa issue non è ancora stata valutata.