공유할 것

https://www.typescriptlang.org/docs/handbook/module-resolution.html

타입스크립트에서 모듈을 해석하는 방법

  1. 상대 경로
import { Response } from './api/respone';
  1. 절대경로
import { Response } from '@/api/respone';

For example, an import statement like import { b } from "./moduleB" in /root/src/moduleA.ts would result in attempting the following locations for locating "./moduleB":

  1. /root/src/moduleB.ts
  2. /root/src/moduleB.tsx
  3. /root/src/moduleB.d.ts
  4. /root/src/moduleB/package.json (if it specifies a types property)
  5. /root/src/moduleB/index.ts
  6. /root/src/moduleB/index.tsx
  7. /root/src/moduleB/index.d.ts

TypeScript will also use a field in package.json named types to mirror the purpose of "main" - the compiler will use it to find the “main” definition file to consult.