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

Q: How to use with TypeScript? #129

Open
manuman94 opened this issue Apr 29, 2020 · 4 comments
Open

Q: How to use with TypeScript? #129

manuman94 opened this issue Apr 29, 2020 · 4 comments

Comments

@manuman94
Copy link

manuman94 commented Apr 29, 2020

Description

I tried to integrate jasmine-expect in my jasmine test framework built in Typescript and I got "types not found" problems. It's not working when I launch the tests but VSCode is complaining too throwing me errors like:
Property 'toBeArray' does not exist on type 'ArrayLikeMatchers<number>'.
I figured out that the problem is that is not finding the type definitions. I downloaded @types/jasmine-expect but is a stub and stills giving me the errors.

Suggested Solution

When I copy the node_modules/jasmine-expect/dist types to node_modules/@types/jasmine-expect folder my project is running. Why don't keep type definitions on its @types folder?

Thank you so much!

@JamieMason
Copy link
Owner

Thanks @manuman94, I do plan to eventually rewrite Jasmine-Matchers in TypeScript but it will take time. In the meantime I wrote a newer version in TypeScript for Jest – but that is for Jest, not Jasmine. A Jasmine version will come in time, I'm planning to create it at expect-more-jasmine then create a backported version of that to publish in this repo.

@manuman94
Copy link
Author

manuman94 commented Apr 30, 2020

Thanks @JamieMason, I've been testing with this matchers and other custom matchers created by me with your library add-matchers and it is awesome. An organized way of creating useful new matchers.

In the meantime I placed a script in my package.json that copies all ".d.ts" files on @types.

Thank you for this awesome library.

@JamieMason
Copy link
Owner

Thanks a lot @manuman94, you're welcome – it's really great to hear of it being used.

@JamieMason
Copy link
Owner

Do you have an example repo somewhere I can look at @manuman94 to try and help? Also, have you seen the TypeScript example at https://github.com/JamieMason/Jasmine-Matchers/tree/03bc19b4170dad265684f112f3a90f5d97fd6998/examples to compare against?

@JamieMason JamieMason changed the title Types not found Q: How to use with TypeScript? Sep 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants