글

라벨이 ts2304 cannot find name인 게시물 표시

TS2304: Cannot find name 'variable'. - 10 Causes and Fixes

이미지
TS2304: Cannot find name 'variable'. is the TypeScript compiler telling you that an identifier you used has no declaration it can see from that position in the file. The name 'variable' in the message is a placeholder for whatever identifier you actually wrote — window , process , describe , MyType , or a plain typo. This is a resolution error, not a type-mismatch error. TypeScript is not saying your value is the wrong shape; it is saying there is no binding with that name in lexical scope, no import that brings it in, and no ambient declaration in the program's type environment. That means there are only three real fix categories: declare it, import it, or widen the type environment ( lib , types , @types/* , include ). Everything below is a concrete instance of one of those three. Causes are ordered most common first. Each one has a reproduction you can paste into a file, the fix, and a way to confirm the fix landed. Error TS2304: Cannot find name ...