typia icon indicating copy to clipboard operation
typia copied to clipboard

Add a warning to the prune function

Open AlexRMU opened this issue 1 year ago • 4 comments

The TS allows you to pass arguments with an extended type. As a result, the shape of the object changes but its type does not.

playground

This cannot be fixed at the moment.

https://stackoverflow.com/questions/76490186/use-type-parameters-with-exact-type-instead-of-extending

Therefore, I suggest adding a warning about this.

AlexRMU avatar Aug 07 '24 15:08 AlexRMU

If you wanna add @warning JSDocTag description, you can do it with PR.

samchon avatar Aug 07 '24 18:08 samchon

You can also add a compile-time check that will generate ts warnings.

AlexRMU avatar Aug 08 '24 06:08 AlexRMU

You are meaning that generate compiler level warning message whenever calling typia.misc.prune<T>() functions?

I don't want that.

samchon avatar Aug 08 '24 06:08 samchon

Not every time, but when necessary, when a generic is passed and it is not equal to the type of the argument.

AlexRMU avatar Aug 08 '24 06:08 AlexRMU