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

Usage within angular6 #18

Closed
stretau opened this issue Sep 19, 2018 · 2 comments
Closed

Usage within angular6 #18

stretau opened this issue Sep 19, 2018 · 2 comments

Comments

@stretau
Copy link

stretau commented Sep 19, 2018

Hi,
actually the library is what I'm looking for. Could you provide an example how I could integrate your .js within angular6 ? the methods works somehow, but I get the following error message on page load

index.js:308 Uncaught ReferenceError: module is not defined
    at index.js:308

This is what I have done so far:

I add in angular.json

"scripts" : [
   "node_modules/typechecker/edition-browsers/index.js"
]

than I add in my typings.d.ts the entry

declare module 'typechecker';

within my component I use:

var tc = require("typechecker");

let test1 = tc.isEmptyObject({});

Is this the correct approach or is there a better way to add your library within angular and of course to avoid any javascript errors ?

Thx and Best Regards

@balupton
Copy link
Member

Seems this should be an issue for Angular, as they don’t support dynamic requires. Angular can follow the @type import annotation in typechecker/index.js, this is what typescript does, or they can add support for the editions format directly - https://github.com/bevry/editions

@balupton
Copy link
Member

please try with the upcoming v5 that will be released later today

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