Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using verbatimModuleSyntax in tsconfig.json causes type check failure #833

Open
2 tasks done
asciiwhite opened this issue Jan 2, 2024 · 1 comment
Open
2 tasks done
Labels
bug Something isn't working

Comments

@asciiwhite
Copy link

Bug report

  • I confirm this is a bug with Supabase, not with my own application.
  • I confirm I have searched the Docs, GitHub Discussions, and Discord.

Describe the bug

Using a tsconfig.json with enabled verbatimModuleSyntax causes type check issues.

vue-tsc --noEmit --composite false

node_modules/@supabase/gotrue-js/src/lib/errors.ts:1:10 - error TS1484: 'WeakPasswordReasons' is a type and must be imported using a type-only import when 'verbatimModuleSyntax' is enabled.

1 import { WeakPasswordReasons } from './types'
           ~~~~~~~~~~~~~~~~~~~

node_modules/@supabase/gotrue-js/src/lib/fetch.ts:3:3 - error TS1484: 'AuthResponse' is a type and must be imported using a type-only import when 'verbatimModuleSyntax' is enabled.

3   AuthResponse,
    ~~~~~~~~~~~~

node_modules/@supabase/gotrue-js/src/lib/fetch.ts:4:3 - error TS1484: 'AuthResponsePassword' is a type and must be imported using a type-only import when 'verbatimModuleSyntax' is enabled.

4   AuthResponsePassword,
    ~~~~~~~~~~~~~~~~~~~~

node_modules/@supabase/gotrue-js/src/lib/fetch.ts:5:3 - error TS1484: 'SSOResponse' is a type and must be imported using a type-only import when 'verbatimModuleSyntax' is enabled.

5   SSOResponse,
    ~~~~~~~~~~~

node_modules/@supabase/gotrue-js/src/lib/fetch.ts:6:3 - error TS1484: 'GenerateLinkProperties' is a type and must be imported using a type-only import when 'verbatimModuleSyntax' is enabled.

6   GenerateLinkProperties,
    ~~~~~~~~~~~~~~~~~~~~~~

node_modules/@supabase/gotrue-js/src/lib/fetch.ts:7:3 - error TS1484: 'GenerateLinkResponse' is a type and must be imported using a type-only import when 'verbatimModuleSyntax' is enabled.

7   GenerateLinkResponse,
    ~~~~~~~~~~~~~~~~~~~~

node_modules/@supabase/gotrue-js/src/lib/fetch.ts:8:3 - error TS1484: 'User' is a type and must be imported using a type-only import when 'verbatimModuleSyntax' is enabled.

8   User,
    ~~~~

node_modules/@supabase/gotrue-js/src/lib/fetch.ts:9:3 - error TS1484: 'UserResponse' is a type and must be imported using a type-only import when 'verbatimModuleSyntax' is enabled.

9   UserResponse,
    ~~~~~~~~~~~~

node_modules/@supabase/gotrue-js/src/lib/helpers.ts:1:10 - error TS1484: 'SupportedStorage' is a type and must be imported using a type-only import when 'verbatimModuleSyntax' is enabled.

1 import { SupportedStorage } from './types'
           ~~~~~~~~~~~~~~~~

node_modules/@supabase/gotrue-js/src/lib/types.ts:2:10 - error TS1484: 'Fetch' is a type and must be imported using a type-only import when 'verbatimModuleSyntax' is enabled.

2 import { Fetch } from './fetch'

Found 10 errors in 4 files.

Errors  Files
     1  node_modules/@supabase/gotrue-js/src/lib/errors.ts:1
     7  node_modules/@supabase/gotrue-js/src/lib/fetch.ts:3
     1  node_modules/@supabase/gotrue-js/src/lib/helpers.ts:1
     1  node_modules/@supabase/gotrue-js/src/lib/types.ts:2

To Reproduce

Add "verbatimModuleSyntax": true to "compilerOptions" inside your tsconfig.json.

Expected behavior

No type check issues should happen.

System information

  • Version of supabase-js: 2.39.2
@asciiwhite asciiwhite added the bug Something isn't working label Jan 2, 2024
@dbm03
Copy link

dbm03 commented Jan 25, 2024

I had also a Type error in my application, even without setting "verbatimModuleSyntax" to true.
The error in my case was in the method resolveFetch() of helpers.ts.

A valid fix for me was updating both Supabase and Typescript to the latest version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants