samchon / nestia

NestJS Helper Libraries + TypeScript OpenAPI generator
https://nestia.io/
MIT License
1.71k stars 87 forks source link

In version `3.1.4` of @nestia/core, `nestia sdk` throws a `no transform has been configured` error. #902

Closed dohyuu closed 1 month ago

dohyuu commented 1 month ago

Bug Report

In version 3.1.4 of @nestia/core with pnpm, nestia sdk throws no transform has been configured error. Did I make a mistake somewhere?

error:

Error on "/nestia-3-1-4-reproduce/src/app.controller.ts" file. Check your code.
Error: Error on nestia.core.TypedRoute.Get(): no transform has been configured. Run "npx typia setup" command, or check if you're using non-standard TypeScript compiler like Babel or SWC.
    at NoTransformConfigureError (/nestia-3-1-4-reproduce/node_modules/.pnpm/@nestia+core@3.1.4_@nestia+fetcher@3.1.4_@nestjs+common@9.4.3_@nestjs+core@9.4.3_reflect-meta_iapmiyy37cygugyb72doi4mlte/node_modules/@nestia/core/src/decorators/internal/NoTransformConfigureError.ts:5:10)
    at /nestia-3-1-4-reproduce/node_modules/.pnpm/@nestia+core@3.1.4_@nestia+fetcher@3.1.4_@nestjs+common@9.4.3_@nestjs+core@9.4.3_reflect-meta_iapmiyy37cygugyb72doi4mlte/node_modules/@nestia/core/src/decorators/internal/get_path_and_stringify.ts:30:63
    at /nestia-3-1-4-reproduce/node_modules/.pnpm/@nestia+core@3.1.4_@nestia+fetcher@3.1.4_@nestjs+common@9.4.3_@nestjs+core@9.4.3_reflect-meta_iapmiyy37cygugyb72doi4mlte/node_modules/@nestia/core/src/decorators/internal/get_path_and_stringify.ts:21:44
    at Object.route [as Get] (/nestia-3-1-4-reproduce/node_modules/.pnpm/@nestia+core@3.1.4_@nestia+fetcher@3.1.4_@nestjs+common@9.4.3_@nestjs+core@9.4.3_reflect-meta_iapmiyy37cygugyb72doi4mlte/node_modules/@nestia/core/src/decorators/TypedRoute.ts:90:79)
    at Object.<anonymous> (/nestia-3-1-4-reproduce/src/app.controller.ts:9:15)
    at Module._compile (node:internal/modules/cjs/loader:1368:14)
    at Module.m._compile (/nestia-3-1-4-reproduce/node_modules/.pnpm/ts-node@10.9.2_@types+node@20.12.11_typescript@5.4.2/node_modules/ts-node/src/index.ts:1618:23)
    at Module._extensions..js (node:internal/modules/cjs/loader:1426:10)
    at Object.require.extensions.<computed> [as .ts] (/nestia-3-1-4-reproduce/node_modules/.pnpm/ts-node@10.9.2_@types+node@20.12.11_typescript@5.4.2/node_modules/ts-node/src/index.ts:1621:12)
    at Module.load (node:internal/modules/cjs/loader:1205:32)

reproduce: https://github.com/dohyuu/nestia-3-1-4-reproduce

git clone https://github.com/dohyuu/nestia-3-1-4-reproduce
cd ./nestia-3-1-4-reproduce
pnpm i
pnpm run sdk

tsconfig: https://github.com/dohyuu/nestia-3-1-4-reproduce/blob/master/tsconfig.json

dependencies:

{
  "dependencies": {
    "@nestia/core": "3.1.4",
    "@nestjs/common": "^9.3.9",
    "@nestjs/config": "^2.2.0",
    "@nestjs/core": "^9.3.9",
    "typia": "^6.0.3"
  },
  "devDependencies": {
    "@nestia/e2e": "^0.4.3",
    "@nestia/fetcher": "3.1.4",
    "@nestia/sdk": "3.1.4",
    "nestia": "^5.3.0",
    "ts-node": "^10.9.2",
    "ts-patch": "^3.1.2",
    "typescript": "5.4.2"
  }
}
samchon commented 1 month ago

When you run the tsc command, you can get the reason why.

src/app.controller.ts:7:3 - error TS(typia.json.TypedRoute.Get): unsupported type detected

- Array<never>
  - JSON does not support undefined type in array.

7   get() {
dohyuu commented 1 month ago

sorry. upon checking again, I was reproducing bug incorrectly. This error was caused by pnpm monorepo workspaces depending on different TypeScript versions (5.3.*and 5.1.*). This issue has been resolved.