zxcvbn-ts / zxcvbn

Low-Budget Password Strength Estimation
https://www.usenix.org/conference/usenixsecurity16/technical-sessions/presentation/wheeler
MIT License
907 stars 72 forks source link

Export more types index.d.ts #65

Closed allardmuis closed 3 years ago

allardmuis commented 3 years ago

Thanks for the great work! I just switched over from the original dropbox-"zxcvbn" and I'm very happy. One thing that made my implementation a bit cumbersome is the fact that most types are not exported. That makes customisation harder that it needs to be.

For example: I process the result of the function to generate a more detailed explanation to the user. It is easy to do that with the return type of the zxcvbn function. For that I have a function that accepts a MatchExtended and generates a message. But the MatchExtended type cannot be imported, so I had to redeclare the type in my own code.

Just exporting some more types in index.d.ts would solve this. I can create a PR for this myself if that is appreciated.

MrWook commented 3 years ago

Hey, all types should be exported somewhere. For Example MatchExtended ist exported in types.d.ts which means you can get it with import { MatchExtended } from '@zxcvbn-ts/core/dist/types'.

But feel free to create a PR to export the types in the index file. I understand that it is more convenient if you can get the types from the normal import like import { MatchExtended } from '@zxcvbn-ts/core'.

allardmuis commented 3 years ago

Thanks MrWook, I didn't realize you could import the types from there!