No
Typscript is sometimes used to document some modules of a project and has only an informative role.
Can we add disabling auto-detect TypeScript in project?
The auto-detection should have no adverse effect if you're not bundling TS files.
Is there a specific problem you're encountering?
I do not fully understand when the TS files are located.
But this code makes me think that the verification is carried out by simply determining the presence of files in the project folder.
function verifyNoTypeScript() {
const typescriptFiles = globby('**/*.(ts|tsx)', { cwd: paths.appSrc });
if (typescriptFiles.length > 0) {
console.warn(
chalk.yellow(
`We detected TypeScript in your project (${chalk.bold(
`src${path.sep}${typescriptFiles[0]}`
)}) and created a ${chalk.bold('tsconfig.json')} file for you.`
)
);
console.warn();
return false;
}
return true;
}
We're probably not going to turn this behavior off unless you're being hit by a specific problem. Can you explain what's breaking?
There is no problem. This is more a question, a suggestion. I would not always like to connect a Typescript when the '.d.ts' files are in the project folder
If you have .d.ts files they should be associated to a TypeScript version. Not installing TypeScript is a behavior prone to breaking, so what we're doing here is correct.
@Timer I do not understand this argument. Consider this situation
.js).d.ts files to make my components easier to consume in TypeScript projectsreact-scripts (locally or in CI) without installing typescriptNote:
tsc here*.ts or *.tsx source files, only *.d.ts declaration and *.js source filesSuggestion:
!*.d.ts) to globby, so that only actual TypeScript source files trigger the need to have typescript installedFacing the exact same issue !
I upgraded my project from react-scripts 1.1.5 to 2.1.1.
We have no typescript files whatsoever, but when I run npm start, I get this:
We detected TypeScript in your project (src/packages/some_package_name/some_private_package/node_modules/camel-case/camel-case.d.ts) and created a tsconfig.json file for you.
It looks like you're trying to use TypeScript but do not have typescript installed.
Please install typescript by running npm install typescript.
If you are not trying to use TypeScript, please remove the tsconfig.json file from your package root (and any TypeScript files).
And if I delete the tsconfig file and run it again, this repeats.
That sounds like a bug @MohammedSiddiqui10p, why is it picking up your node_modules?
We have a git submodule in our project because we have to consume a private package which isn't published anywhere. So we have a .gitmodules file in our root which tells git where to place our private package.
[submodule "src/packages/some_private_package/some_name"]
path = src/packages/some_private_package/some_name
url = [email protected]:some_github_link.git
I'm getting a similar issue to @MohammedSiddiqui10p:
We detected TypeScript in your project (src\node/node_modules/npm/node_modules/worker-farm/index.d.ts)
For me, it's because my UI is built as part of a Maven build that installs node (hence src\node/node_modules, looks like there's some unrelated dodgy path concatenation there too).
The fix for me was to change my build config to install Node into the target directory instead of src.
The real issue
As a TL;DR, the issue looks to be occurring for anyone who has node packages in their project outside of the usual node_modules folder.
same problem
I'm having this issue as well. I'm using Bit, which embeds packages in my src folder, along with their dependencies in a node_modules folder, and some of those dependencies have .d.ts files. Now I can't even run yarn start. Thoughts?
Most helpful comment
@Timer I do not understand this argument. Consider this situation
.js).d.tsfiles to make my components easier to consume in TypeScript projectsreact-scripts(locally or in CI) without installingtypescriptNote:
tschere*.tsor*.tsxsource files, only*.d.tsdeclaration and*.jssource filesSuggestion:
!*.d.ts) to globby, so that only actual TypeScript source files trigger the need to havetypescriptinstalled