We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
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
this
Test
name
string
Actual behavior: Argument of type '"name"' is not assignable to parameter of type 'never'.
Playground Link: Playground Link
Related Issues:
The text was updated successfully, but these errors were encountered:
Maybe this is the same Issue as I have.
I would expect that this would cry a river at @testProperty('shouldNotWork') but it doesn't:
@testProperty('shouldNotWork')
function testProperty<T>(otherProperty: keyof T): PropertyDecorator { return (target, propertyKey) => { // ... some code }; } class Test { @testProperty('shouldWork') test: boolean = true; @testProperty('shouldNotWork') test2: boolean = true; shouldWork: boolean = true; }
My current workaround is to define the type manually like this:
class Test2 { @testProperty<Test2>('shouldWork') test: boolean = true; @testProperty<Test2>('shouldNotWork') test2: boolean = true; shouldWork: boolean = true; }
https://www.typescriptlang.org/play/index.html?experimentalDecorators=true#code/GYVwdgxgLglg9mABFApgZygBQE5wA4rZQCeAPACoB8AFHFABaE76EkBciA1isXMIuQCUHZgSLEAIighxsAQyizEAbwCwAKERbE2FFBDYk1KHOwBzPQBpEeXGJIBpHoMQBeSio3bviAPS-EADpgxDQ4AFsURBkAExQvbQBfAG4NRI0NCAAbOTQ0AXQoT01tAAFUDFFWYmoAcjR6OBAsmIB1WU5awQStCqgOACM4OCyUOSRXZGwQFFSSrXLCqvE6hqaWgDk6duxO7vnkQoAmQeHR8bcpmbnvNea2jtORsYmr2bSM9Wzc-PJj4u8i0qdmqFGONHqjXuOz2PUOGCe51eUGm7wOQKwIPEYIwRwhd022w6XThfROiCGzwukxR1zhBIeu0RL0utLRiSAA
Sorry, something went wrong.
rbuckton
No branches or pull requests
TypeScript Version: 3.5.1
Search Terms:
Code
Expected behavior:
Automatically detect
this
should be type ofTest
, andname
should be type ofstring
Actual behavior:
Argument of type '"name"' is not assignable to parameter of type 'never'.
Playground Link:
Playground Link
Related Issues:
The text was updated successfully, but these errors were encountered: