CKGrafico / inversify-props

Wrapper of Inversify to inject your dependencies in the components, made with TypeScript and compatible with Vue, React and other component libraries.
MIT License
85 stars 9 forks source link

what's the meaning of this line? #1

Closed stkevintan closed 5 years ago

stkevintan commented 5 years ago

https://github.com/CKGrafico/inversify-props/blob/9d0313987d3364b2833591acffd39195630b2bc0/src/lib/helpers.ts#L28

I copy this line to my file but got a error:

Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '(target: object, propertyKey: string | number | symbol) => boolean'.
  No index signature with a parameter of type 'string' was found on type '(target: object, propertyKey: string | number | symbol) => boolean'.ts(7053)
CKGrafico commented 5 years ago

This line is deleting the property and the next line is creating a new property with the dependency injected into the Class

stkevintan commented 5 years ago

@CKGrafico I know you intend to delete the property and readd it with a custom getter.

However, I think Reflect.deleteProperty is a function not an object, it cannot be invoked by [key]

The right way should be:

Reflect.deleteProperty(target, key)

Am I right ?

CKGrafico commented 5 years ago

Which version of typescript are you using? This is working in all our projects, can you download the examples and test them?

CKGrafico commented 5 years ago

check with he new version

stkevintan commented 5 years ago

Thx, the ts 3.5 show no error of your form.

CKGrafico commented 5 years ago

Yeah! thanks for your patience and sorry for the bug :)