Skip to content
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

Use of SharedArrayBuffer in index.d.ts #27

Closed
rfreedman opened this issue May 5, 2020 · 3 comments
Closed

Use of SharedArrayBuffer in index.d.ts #27

rfreedman opened this issue May 5, 2020 · 3 comments

Comments

@rfreedman
Copy link

I'm using exifr in an Angular 8 / Typescript application.
"production" compilation fails due to presence of SharedArrayBuffer in node_modules/exifr/index.d.ts

The line is

type Input = ArrayBuffer | SharedArrayBuffer | Buffer | Uint8Array | DataView | string | Blob | File | HTMLImageElement

I'm not sure if, for general consumption, SharedArrayBuffer needs to be an input type, but I'm not using it as an input type, and it breaks my build.

I solved the issue by overriding index.d.ts with a copy with SharedArrayBuffer removed, in my application's directory, by pointing to it in tsconfig.json.

If you think that removal of SharedArrayBuffer is appropriate for the distribution version, and don't want to make the change yourself, let me know, and I'll submit a pull request.

Thanks!

rfreedman@chariotsolutions.com

@MikeKovarik
Copy link
Owner

MikeKovarik commented May 5, 2020

Hello, thanks for checking in.

I briefly looked into it and I don't understand how this can happen. SAB was invented for browsers
years ago andd has been supported by Nodejs as well for some time now. So I am confused why that breaks for you. Could you tell me more about your build process, config, the errors it throws, build targets. Are you perhaps targeting older browsers that don't support SAB?

I'd rather first try to solve the issue differently rather than straight out deleting SAB from supported types because I can see someone messaging me "you said exifr works in workers but typescript says otherwise"

@rfreedman
Copy link
Author

Thanks,

Yes, it turned out that I was targeting an older version of JS - I updated my tsconfig to have "target" set to es2015 and "lib" set to es2018 (which are apparently the new default settings for Angular apps), and it all compiled and ran fine without overriding the declaration file.

Thanks again!

@MikeKovarik
Copy link
Owner

Awesome. Than I'm closing this as a non-issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants