nhost / hasura-auth

Authentication for Hasura.
https://nhost.io
MIT License
376 stars 111 forks source link

Typescript error #419

Closed narawit-tub closed 4 months ago

narawit-tub commented 11 months ago

in src/routes/pat/pat.ts

when I run pnpm run dev I will got

Compilation error in C:\Users\Admin\Repositories\hasura-auth\src\routes\pat\pat.ts
(node:12704) UnhandledPromiseRejectionWarning: Error: ⨯ Unable to compile TypeScript:
src/routes/pat/pat.ts:4:10 - error TS2305: Module '"@/utils/__generated__/graphql-request"' has no exported member 'AuthRefreshTokenTypes_Enum'.

4 import { AuthRefreshTokenTypes_Enum } from '@/utils/__generated__/graphql-request';
           ~~~~~~~~~~~~~~~~~~~~~~~~~~

    at Object.<anonymous> (C:\Users\Admin\Repositories\hasura-auth\src\routes\pat\pat.ts:1:7)
    at Module._compile (node:internal/modules/cjs/loader:1254:14)
    at Module._compile (C:\Users\Admin\Repositories\hasura-auth\node_modules\.pnpm\source-map-support@0.5.21\node_modules\source-map-support\source-map-support.js:568:25)
    at Module.m._compile (C:\Users\Admin\AppData\Local\Temp\ts-node-dev-hook-07711649148068389.js:69:33)
    at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
    at require.extensions.<computed> (C:\Users\Admin\AppData\Local\Temp\ts-node-dev-hook-07711649148068389.js:71:20)
    at Object.nodeDevHook [as .ts] (C:\Users\Admin\Repositories\hasura-auth\node_modules\.pnpm\ts-node-dev@1.1.8_typescript@4.5.4\node_modules\ts-node-dev\lib\hook.js:63:13)
    at Module.load (node:internal/modules/cjs/loader:1117:32)
    at Function.Module._load (node:internal/modules/cjs/loader:958:12)
    at Module.require (node:internal/modules/cjs/loader:1141:19)
    at require (node:internal/modules/cjs/helpers:110:18)
    at Object.<anonymous> (C:\Users\Admin\Repositories\hasura-auth\src\routes\pat\index.ts:4:1)
    at Module._compile (node:internal/modules/cjs/loader:1254:14)
    at Module._compile (C:\Users\Admin\Repositories\hasura-auth\node_modules\.pnpm\source-map-support@0.5.21\node_modules\source-map-support\source-map-support.js:568:25)
    at Module.m._compile (C:\Users\Admin\AppData\Local\Temp\ts-node-dev-hook-07711649148068389.js:69:33)
    at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
(Use `node --trace-warnings ...` to show where the warning was created)
[ERROR] 16:28:20 ⨯ Unable to compile TypeScript:
src/routes/pat/pat.ts:4:10 - error TS2305: Module '"@/utils/__generated__/graphql-request"' has no exported member 'AuthRefreshTokenTypes_Enum'.

4 import { AuthRefreshTokenTypes_Enum } from '@/utils/__generated__/graphql-request';
           ~~~~~~~~~~~~~~~~~~~~~~~~~~

(node:12704) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)

my workaround is using import { Auth_Refresh_Token_Types_Enum } from '@/utils/__generated__/graphql-request'; instead.

onehassan commented 11 months ago

Thank you posting this. If you look here AuthRefreshTokenTypes_Enum is clearly defined, so you should be able to use that. I suppose you have another issue related to codegen.

stale[bot] commented 5 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.