< 상황 >
tsconfig.json 에서 설정한 typeRoots 설정이 tsc를 통한 실행은 동작하지만,
ts-node 에서 동작하지 않았다.
< 해결 >
TS2339: Property 'user' does not exist on type 'Request<ParamsDictionary, any, any, ParsedQs>' · Issue #46861 · DefinitelyType
When trying to extend the Request interface from the package express to add some custom properties, I'm getting the following typescript error on my routers: ..\node_modules\ts-node\src\index.t...
github.com
위 글을 보고 오류를 해결했다.
ts-node 옵션으로 --files 를 추가해주면 잘 돌아간다.
ts-node --files --project tsconfig.server.json server/index.ts
마지막으로 --files가 뭔지 확실히 하고 넘어가자
ts-node
TypeScript execution environment and REPL for node.js, with source map support
www.npmjs.com
npm ts-node 에 들어가 --files를 검색해보면 설명은 다음 과 같다.
--files Load files, include and exclude from tsconfig.json on startup
Default: false
반응형
'Programming Step > Typescript' 카테고리의 다른 글
Index Signature, 제네릭 keyof (0) | 2022.06.29 |
---|---|
typescript string literal 과 string enums의 차이 (0) | 2022.06.29 |
댓글