-
-
Notifications
You must be signed in to change notification settings - Fork 172
New issue
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
Support re-usable factory functions #247
Comments
It is possible to converting such However, I head that such statement is sometimes dangerous because even mistaken code could be transpiled. Therefore, I need to get hear many users' ideas about this issue. Before listening and accepting or rejecting this issue, I recommend you to define function variable like below instead. For reference, below hoisting function does not reduce performance when comparing with your suggestion. import TSON from "typescript-json";
const verifier = (input: string) => TSON.is<string>(input); |
Thanks for the quick response! Although it works for now, my main issue with that solution is not performance but ugliness of having to write the type twice, making the code less readable and more annoying to change. I can't comment on the potential dangers, as I do not have experience with implementing transformations. Solutions could be:
|
I couldn't understand why However, listening your suggestion, I understood that why those functions are provided. How do you think about in this case? Whether introducing making hoisting function would be better or creating those new functions like |
I don't know what makes Having to wrap |
Okay, I will consider better solution and it would be published at this Sunday, maybe. Thanks for suggestion. |
I agree with you that such statement is right However, there're some people who've migrated from npm install --save typescript-json@next
|
@janvanbouwel Now, update to |
Develop #247 - reusable factory functions
Works like a charm, thanks a lot! |
Summary
Passing
is<>
as an argument does not get transformed, and there is no alternative likecreateIs<>()
. In case this is intended behaviour, the error message is unhelpful.Code example
The text was updated successfully, but these errors were encountered: