6

I am stuck with TypeScript error:

Failed to compile.

undefined
TypeScript error in undefined(undefined,undefined):
File name '/path/to/file/MyFileName.types.tsx' differs from already included file name '/path/to/file/myFileName.types.tsx' only in casing.  TS1149

Spot the difference in first letter between myFileName and MyFileName. I have not idea how this happened and I don't know how to fix it. I have never seen this error before. I am using TypeScript Version 3.5.3. If someone can at least point me into direction what to do, it would be super helpful.

1
  • For a similar issue I had to rm -rf node_modules and then yarn install again. Not quite sure what the issue was Commented Feb 11, 2021 at 16:45

4 Answers 4

5

For my case, I just installed packages with this command

npm i

Sign up to request clarification or add additional context in comments.

Comments

3

Oh crap. There was a lowercased import somewhere in my code:

import { TSomething } from './myFileName.types'

while real file name was uppercased:

MyFileName.types.tsx

I still don't know why TypeScript compiler didn't tell me where was that.

Comments

2

Just run:
"yarn tsc" or npm. Works!

Comments

0

Ok, this is probably the craziest error I've ever seen.

Context

  • vue 2.6.10
  • typescript 4.4.3
  • Built using webpack via vue-cli-service build.

I was getting following error on build:

⠼  Building for production...

 ERROR  Failed to compile with 1 errors                                                                                                   10:49:11

 error  in [internal]

INTERNAL ERROR(undefined,undefined) Debug Failure.
stack trace:
Error: Debug Failure.
    at /Users/user/path/to/repo/node_modules/typescript/lib/typescript.js:19487:89
    at String.replace (<anonymous>)
    at formatStringFromArgs (/Users/user/path/to/repo/node_modules/typescript/lib/typescript.js:19487:21)
    at Object.createDetachedDiagnostic (/Users/user/path/to/repo/node_modules/typescript/lib/typescript.js:19503:20)
    at parseErrorAtPosition (/Users/user/path/to/repo/node_modules/typescript/lib/typescript.js:30898:42)
    at parseErrorAt (/Users/user/path/to/repo/node_modules/typescript/lib/typescript.js:30905:13)
    at parseErrorAtCurrentToken (/Users/user/path/to/repo/node_modules/typescript/lib/typescript.js:30892:13)
    at parseErrorForInvalidName (/Users/user/path/to/repo/node_modules/typescript/lib/typescript.js:31130:17)
    at parseErrorForMissingSemicolonAfter (/Users/user/path/to/repo/node_modules/typescript/lib/typescript.js:31102:21)
    at parseExpressionOrLabeledStatement (/Users/user/path/to/repo/node_modules/typescript/lib/typescript.js:34993:21)

 ERROR  Build failed with errors.

Solution

The error was an HTML text in Vue template.

<template>
  ...
  Please type "{{ listName }}" to confirm.
  ...
</template>

I had to replace the word type with something else to fix the TypeScript error:

Please write "{{ listName }}" to confirm.

Update

After further experimenting, what's causing the issue is the following pattern in HTML text:

type "

Where anything can be between the double quotes, so type "", type "hello", etc, all cause this error.

Conversely, when I put anything between the type and ", it builds again, eg type a ".

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.