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

Update typings to communicate the jsQR function exists on window #108

Open
TomasHubelbauer opened this issue Dec 29, 2018 · 0 comments
Open

Comments

@TomasHubelbauer
Copy link

TomasHubelbauer commented Dec 29, 2018

The typings file is a module file, it uses export default, which means the declare function statement is applied to the module scope, not the window scope.

I am developing a Javascript project, which only uses Typescript for type checking but doesn't have a build process or use a bundler. I am referencing the package using a script tag. I have set up Typescript to type check my Javascript files, but since the package is referenced using a script tag, I need to let Typescript know it should use jsQR typings in the project. The way to do this is to use compilerOptions.types, which is what I do, but unfortunately the typings as they are right now don't work to make Typescript know the function exists on the window scope, which is how I am accessing it at runtime.

I don't yet understand how to create typings which at the same time use export default (or otherwise export in order to be used as a module) and also correctly contribute to the window scope. I am hoping you do, or can help me understand how to do that for me to be able to create a PR. Thank you

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

1 participant