Closed peterhalicky closed 2 years ago
@peterhalicky - the import jsep from 'jsep'
(vs import * as jsep from 'jsep'
) would require the esModuleInterop
typescript option enabled... which might not be so bad since the readme indicates examples of that form.
Alternately, I tried this and it seems to work:, and it might have less impact to existing users
import * as jsep from 'jsep';
import { IPlugin } from 'jsep';
// ...plugin
declare const _export: IPlugin;
export default _export;
Any thoughts on something like this?
I'm no expert on TS, but if I understand this correctly, you redeclare the type of the export to be IPlugin
, essentially doing more of what I did as a workaround (xyz as unknown as IPlugin
), right? Either way, I do not feel competent to judge if this is the right solution - but if it works, it's good enough for me.
(Note: I do have the esModuleInterop
option enabled)
:tada: This issue has been resolved in version 1.3.7 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
:tada: This issue has been resolved in version @jsep-plugin/arrow-v1.0.5 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
:tada: This issue has been resolved in version @jsep-plugin/assignment-v1.2.1 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
:tada: This issue has been resolved in version @jsep-plugin/async-await-v1.0.2 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
:tada: This issue has been resolved in version @jsep-plugin/comment-v1.0.3 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
:tada: This issue has been resolved in version @jsep-plugin/new-v1.0.2 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
:tada: This issue has been resolved in version @jsep-plugin/numbers-v1.0.1 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
:tada: This issue has been resolved in version @jsep-plugin/object-v1.2.1 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
:tada: This issue has been resolved in version @jsep-plugin/regex-v1.0.3 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
:tada: This issue has been resolved in version @jsep-plugin/spread-v1.0.2 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
:tada: This issue has been resolved in version @jsep-plugin/template-v1.0.2 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
:tada: This issue has been resolved in version @jsep-plugin/ternary-v1.1.3 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
It is not possible to use any of the provided plugins with Typescript (well - I've tried two). The following code:
Produces errors by tsc:
The only way I found to work around this is to use
jsep.plugins.register(comment as unknown as IPlugin)
, although that seems to be a bit ugly.When I modified the plugin's tsd.d.ts and changed the first line
import * as jsep from 'jsep';
toimport jsep from 'jsep';
then the compiler error disappeared. This is probably the way to fix the issue, although I will leave it to the authors to decide if that is the right solution.Code/project to reproduce the problem can be found here: https://github.com/peterhalicky/jsep-plugin-issue