-
Notifications
You must be signed in to change notification settings - Fork 83
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
TypeScript example compilation errors #52
Comments
This can be resolved by importing:
as the first line, however I'm not sure whether or not that is an acceptable solution? If so, I can create a PR. |
I assume in your You are then exporting something from There are three solutions to this:
|
Thanks for the quick reply... Yes, this project in question is exporting modules for import into other projects so you're quite correct that we have I'm happy with my resolution to the problem but wanted to flag up the issue in case other developers hit the same problem. |
Note that the example uses a separate tsconfig.json for the tests. That config includes the following "types": ["intern"] This has the same effect as |
I had a separate I'm just reporting what I experienced in case this is something that other people encounter. Maybe I needed to run TSC from within the |
Could you post a sample project somewhere? The example itself builds properly whether or not declarations are enabled in "tests/tsconfig.json", and I'd like to look into your specific situation in a bit more detail. In general, if you're creating a project that's exporting test functionality (like helper functions for Intern), it would make sense to have a single |
Unfortunately I can't post my project as-is (without disclosing private company information) but could look to create a sample project with similar configuration when I get a chance. I agree that it makes sense to keep the tsconfig separate, but the example is extending the configuration - it might be better to define a separate config without explicitly without extending. My point here isn't to criticize for the sake of it... I really like Intern, I just want to help reduce barriers to entry which was I raised the issue. It's not especially blocking me at the moment, I just wanted to make you aware it had happened. Our main tsconfig looks like this though: {
"compilerOptions": {
"allowJs": false,
"allowSyntheticDefaultImports": true,
"declaration": true,
"jsx": "react",
"module": "commonjs",
"noImplicitAny": false,
"outDir": "dist",
"removeComments": true,
"inlineSourceMap": true,
"strictNullChecks": true,
"lib": [
"es6",
"dom"
],
"target": "es5"
},
"include": [
"node_modules/@types/**/*.d.ts",
"src/**/*.ts",
"src/**/*.tsx"
],
"exclude": [
"deps**/*"
]
} ...and the nested version looks like this: {
"declaration": false,
"extends": "../tsconfig.json",
"compilerOptions": {
"baseUrl": "..",
"types": [ "intern" ]
},
"include": [
"./**/*.ts"
]
} |
I definitely appreciate the information. This just seems more like an issue with a specific use case than a problem with the example. There wouldn't really be any benefit to separating the configs here. I mean, the tests should be built with almost all the same settings as the application, with only a few test-specifi differences, which is the intended use case for Note that "declaration" is a compiler option, so should be in |
I'm trying to write functional tests using TypeScript and have followed the example provided. However I'm getting compilation errors:
...generated from the line:
...which is taken directly from the example
The tests themselves do actually run when treated as JavaScript (however I needed to modify the
leadfoot/keys
import to be:const keys = require('@theintern/leadfoot/keys').default;
)The text was updated successfully, but these errors were encountered: