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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Typescript support for afterCreate #1054

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

tuzmusic
Copy link

@tuzmusic tuzmusic commented Aug 7, 2022

To address #1052. Includes a test in factory-test.ts.

By the way, in that test file, // $ExpectError still shows as a TS error, although that might just be for me in Webstorm. // @ts-expect-error, placed above the line, shows no red wavy line. Although I don't know if there's a similar equivalent for $ExpectType. @zoltan-nz is there anywhere that these "tests" are run or anything?

I would be happy to swap those error assertions as part of this PR, or alternatively in a separate PR, if you'd like. Let me know!

(馃コ my first OSS PR!)

@IanVS
Copy link
Collaborator

IanVS commented Aug 8, 2022

Hi, thanks for this PR! To answer your question, we do test the typescript definitions in CI: https://github.com/miragejs/miragejs/runs/7725993547?check_suite_focus=true#step:6:1, and it looks like they are passing in this PR. However, there's a formatting error that is failing. You can run yarn prettier:update and check in the results to fix that one. I'll give this a better review and try it out in my own project shortly.

@IanVS
Copy link
Collaborator

IanVS commented Aug 8, 2022

It looks like our prettier commands are not working the way we want. Sorry to ask you this, but could you run yarn prettier --write types/tests/factory-test.ts and check that in? I'll fix the package.json script in another PR. Or, if you're having trouble, I'll check out your branch and push the fix in a day or two.

@cah-brian-gantzler
Copy link
Collaborator

Forgetting to run prettier always bytes me on PRs. For my own repos I put husky in place to run prettier on commits just to avoid that

@tuzmusic
Copy link
Author

tuzmusic commented Aug 8, 2022

Hm, I'm not sure why there's a failure on my last run. I just ran the ci script locally and it passed..

@IanVS
Copy link
Collaborator

IanVS commented Aug 8, 2022

That's strange. OK, don't worry about it, I'll look into it. Thanks again for putting together the PR.

@IanVS
Copy link
Collaborator

IanVS commented Aug 8, 2022

I'm testing this out in my own app and getting a lot of type errors. I'll try to figure out what's going on and report back.

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

Successfully merging this pull request may close these issues.

None yet

3 participants