-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Add TypeScript recipe #589
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
Conversation
return Promise.resolve('foo'); | ||
} | ||
|
||
test(async (t) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test(async t => {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't work. See microsoft/TypeScript#4885 (comment)
Can you also add a link to the readme? |
{ | ||
"compilerOptions": { | ||
"module": "commonjs", | ||
"target": "es2015" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you also add outDir
? That will compile the sources to a different directory. If you place all files in the same directory, you can easily confuse JS fileswith TS files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure about the outDir
. AVA looks for test.js
or test/*.js
if I'm not mistaken. So what should I use as value for outDir
then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have used lib/test
for the TS tests and dist/test
for the compiled tests. The options should be "outDir": "dist", "rootDir": "lib"
.
AVA needs some configuration for that, I started AVA using ava dist/test
. It can also be configured in the readme. Though maybe dist/test/*.js
could be added as a new test location?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't it quite specific per project? I mean, some people will use TypeScript for the entire project, some might only use it for the tests. I don't want to force them in using a specific approach or directory structure. This recipe is just for the basics, they can always go from here and do some more advanced stuff with it, no?
👍 after you've addressed my two minor comments |
@sindresorhus What link? Link to the AVA readme? Can't find something similar in the other recipes so guess I'm a little confused :p. |
Damnit, just screwed up squasing my commits. Let me try to fix it. |
Alright, don't gonna touch the commits anymore :). Not sure if I should add the @sindresorhus tips for squashing when you had to sync with the remote in between? It totally got screwed up the previous time :). |
TypeScript users should already know how to use the |
We can always improve depending on the feedback via twitter/gitter/issues. |
Don't sync with |
But don't worry. I'll squash when I merge. |
@sindresorhus Alright, thanks for the tip :)! |
Landed. I'd like to keep it simple as is. TypeScript will (should) know how to use the TSC options. Not the correct place to teach it here. Thanks Sam! |
Glad I could help :) |
👍 |
off topic I'd like to chime in on this statement and say; put it in your global git config. Fire and forget. Be rid of any nonsense
I for one can't think of a time and place where a straight up git pull would be preferential. Sorry for the off topic comment! |
Thanks @kasperlewau . Will save me some headaches in the future :). |
I kept it simple. Feel free to provide feedback if I missed something or if I have to add some extra things.
@ivogabe Something you would like to add or improve?