-
Notifications
You must be signed in to change notification settings - Fork 41
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
Trouble in Angular6 project with Typescript #18
Comments
Hey @zedzorander, thanks for reporting the issue. I'm not well versed with TypeScript and Angular 6. The issue you mentioned doesn't look like an issue with password-validator, given it's pretty standard JavaScript module. I'll dig for possible reasons of this behaviour and update here, if any. |
Yeah, my program isn't recognizing the module for some reason. I found some stuff which makes me think it needs a definition file for it to work. Here is an article I found that seems to be related to what I was experiencing. It might be a good start. https://academind.com/learn/angular/angular-q-a/#integrate-third-party-libraries. Thanks. |
Yes, the link you shared suggests a way to add libraries without any declaration file. In my understanding it should look something like: import 'password-validator';
declare var PasswordValidator: any;
@Component({...})
export class MyComponent {...} |
I think the problem @zedzorander is facing is with ES6 imports. I used "import PasswordValidator from 'password-validator';" and it is working for me. Could you please check that? |
Try this, it will work. @zedzorander
|
+1 having troubles with Typescript. I'm importing as declaring the schema as and getting the following error |
Hey @marcomartinscastanho thanks for describing your issue. I tried reproducing this but failed. Here's a stackblitz url showing the password-validator being imported in a sample TypeScript project. Hopefully you will be able to resolve the issue. If not, can you share a reproducible example of the issue? |
same problem in nestjs, |
Types have been updated in line with the documentation provided at https://www.typescriptlang.org/docs/handbook/declaration-files/dts-from-js.html Fixes #18
Types have been updated in line with the documentation provided at https://www.typescriptlang.org/docs/handbook/declaration-files/dts-from-js.html Fixes #18
This error should be fixed in |
@tarunbatra I met this error with 5.3.0
|
I'm sure i'm doing something dumb but I'm trying to use this in my project and I'm having trouble getting it to work. It says it can't find a declaration file and that the index.js file implicitly has an any type. I added this to my tsconfig file
"noImplicitAny": false,
but it's still giving me this warning. I'm importing it in my component like this:import * as PasswordValidator from '../../../node_modules/password-validator';
. I've also tried it like this:import { PasswordValidator } from '../../../node_modules/password-validator';
.When I console log schema it gives me this error message..
ERROR TypeError: Cannot read property 'is' of undefined at AccountFormComponent.push../src/app/account-form/account-form.component.ts.AccountFormComponent.validatePassword (account-form.component.ts:67) at Object.eval [as updateRenderer] (AccountFormComponent.html:69) at Object.debugUpdateRenderer [as updateRenderer] (core.js:10879) at checkAndUpdateView (core.js:10255) at callViewAction (core.js:10491) at execComponentViewsAction (core.js:10433) at checkAndUpdateView (core.js:10256) at callViewAction (core.js:10491) at execEmbeddedViewsAction (core.js:10454) at checkAndUpdateView (core.js:10251)
I'm just using the example code in your README. Not sure where to go from here. Thanks
The text was updated successfully, but these errors were encountered: