Would you be interested in adding type definitions to ava? This would allow TypeScript users to easily use ava, since TypeScript can automatically find typings for node modules that have included them. JavaScript programmers that use VSCode would also benefit from better completions.
The type definitions can be added as a single file. You can find more details in the wiki.
If you would merge a pull request on this, I can create a PR.
I don't think anyone on the team uses TypeScript, so would be hard to keep up to date, but if anyone from the community is willing to maintain it, I'm :+1:.
I can update the definitions if you notify me of changes. I have submitted a PR: #571
+1
@ivogabe Ava with typings in VSCode!?
I'm trying to use VSCode as my editor in a project using both ava and mocha for testing.
I have the following setup:
{
"compilerOptions": {
"module": "commonjs",
"target": "es2015",
"moduleResolution": "node",
"allowSyntheticDefaultImports": true,
"noImplicitAny": true,
"allowJs": true,
"types": ["mocha", "node"]
},
"exclude": [
"node_modules"
],
"files": [
"typings/index.d.ts"
]
}
with a typings folder containing index.d.ts with the following install via typings binary
F.ex typings install dt~mocha --global --save
/// <reference path="globals/chai/index.d.ts" />
/// <reference path="globals/mocha/index.d.ts" />
From the Typescript section of the ava docs, I'm led to believe it will auto-detect the ava typing files using my tsconfig.json and I would assume that:
"files": [
"typings/index.d.ts"
]
Would somehow make the global typings available for the linter in my files? or only for compile?
Do I need the weird triple /// syntax in each test file in order for test to not cause a linter error?
/// <reference path="../../typings/globals/ava/index.d.ts" /> etc.
This would be ridiculous to maintain!! Please advice and provide better docs on this aspect. Thanks!
@kristianmandrup It looks like you're using both typings and @types? I'd advise to use the latter. You can simply run npm install @types/node @types/mocha, set "types": ["mocha", "node"] (like you already did) and TypeScript will find the type definitions. The type definitions for AVA are automatically found with no additional configuration needed. I'm not familiar with the configuration needed for typings.