gsamaras gsamaras - 6 months ago 33
Javascript Question

Can I restrict a function to be pure in TypeScript?

Is there a way to allow a function to be pure only (thus not accepting the function to be non pure) in TypeScript? If yes, which?

Answer Source

You might be able to write a few TSLint rules to catch most of the common cases (access to outside variables, for example), but checking something like that is reducible to the halting problem, so there's no way to actually know 100%.

You (and your team) still have to be disciplined.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download