Closed OliverJAsh closed 2 years ago
I believe this can be solved by using a Babel plugin that adds the pure annotation to output of TypeScript.
Pure annotations are very easy to miss and hard to get right, so perhaps we should automate this across the fp-ts ecosystem, using something like one of these tools. WDYT @gcanti?
@gcanti Have you tried to do anything like this before? If not then I can take a look.
@OliverJAsh No I haven't, I was afraid to mess up the tsc
output
We also need to add pure annotations to the classes defined in
index.js
, however we can't add the pure annotation in the correct position because these are transpiled to IIFEs.For example: https://github.com/gcanti/monocle-ts/blob/9bd7fa62e97f96c92c7ac7f4be9de3752842e5ee/src/index.ts#L1465
This will become:
The pure annotation needs to be added like so:
I believe this can be solved by using a Babel plugin that adds the pure annotation to output of TypeScript. Alternatively, we can disable class transpilation.
Pure annotations are very easy to miss and hard to get right, so perhaps we should automate this across the fp-ts ecosystem, using something like one of these tools. WDYT @gcanti?