Skip to content

Conversation

@GauthierPLM
Copy link
Contributor

@GauthierPLM GauthierPLM commented Nov 3, 2025

  • Updated code to use explicit type exports, following TypeScript best practices and ensuring a type is never used as a value.
  • Enabled verbatimModuleSyntax for better adherence to TypeScript module syntax standards. It will also cause a build error if a type is used as value (class, constant, ...).

Background

I encounter errors when enabling verbatimModuleSyntax on my NestJS app, with errors reported from nestjs-dataloader: TS will complain that types are exported as values:

../../node_modules/@strv/nestjs-dataloader/src/Dataloader.factory.ts:106:3 - error TS1205: Re-exporting a type when 'verbatimModuleSyntax' is enabled requires using 'export type'.

106   LoaderFrom,
      ~~~~~~~~~~
../../node_modules/@strv/nestjs-dataloader/src/Dataloader.factory.ts:107:3 - error TS1205: Re-exporting a type when 'verbatimModuleSyntax' is enabled requires using 'export type'.

107   Aggregated,
      ~~~~~~~~~~
../../node_modules/@strv/nestjs-dataloader/src/index.ts:1:10 - error TS1205: Re-exporting a type when 'verbatimModuleSyntax' is enabled requires using 'export type'.

1 export { LifetimeKeyFn, DataloaderOptions, DataloaderModuleOptions } from './types.js'
           ~~~~~~~~~~~~~
../../node_modules/@strv/nestjs-dataloader/src/index.ts:1:25 - error TS1205: Re-exporting a type when 'verbatimModuleSyntax' is enabled requires using 'export type'.

1 export { LifetimeKeyFn, DataloaderOptions, DataloaderModuleOptions } from './types.js'
                          ~~~~~~~~~~~~~~~~~
../../node_modules/@strv/nestjs-dataloader/src/index.ts:1:44 - error TS1205: Re-exporting a type when 'verbatimModuleSyntax' is enabled requires using 'export type'.

1 export { LifetimeKeyFn, DataloaderOptions, DataloaderModuleOptions } from './types.js'
                                             ~~~~~~~~~~~~~~~~~~~~~~~
../../node_modules/@strv/nestjs-dataloader/src/index.ts:4:29 - error TS1205: Re-exporting a type when 'verbatimModuleSyntax' is enabled requires using 'export type'.

4 export { DataloaderFactory, LoaderFrom, Aggregated } from './Dataloader.factory.js'
                              ~~~~~~~~~~
../../node_modules/@strv/nestjs-dataloader/src/index.ts:4:41 - error TS1205: Re-exporting a type when 'verbatimModuleSyntax' is enabled requires using 'export type'.

4 export { DataloaderFactory, LoaderFrom, Aggregated } from './Dataloader.factory.js'
                                          ~~~~~~~~~~
../../node_modules/@strv/nestjs-dataloader/src/types.ts:34:3 - error TS1205: Re-exporting a type when 'verbatimModuleSyntax' is enabled requires using 'export type'.

34   Factory,
     ~~~~~~~
../../node_modules/@strv/nestjs-dataloader/src/types.ts:35:3 - error TS1205: Re-exporting a type when 'verbatimModuleSyntax' is enabled requires using 'export type'.

35   LifetimeKeyFn,
     ~~~~~~~~~~~~~
../../node_modules/@strv/nestjs-dataloader/src/types.ts:36:3 - error TS1205: Re-exporting a type when 'verbatimModuleSyntax' is enabled requires using 'export type'.

36   DataloaderOptions,
     ~~~~~~~~~~~~~~~~~
../../node_modules/@strv/nestjs-dataloader/src/types.ts:37:3 - error TS1205: Re-exporting a type when 'verbatimModuleSyntax' is enabled requires using 'export type'.

37   DataloaderModuleOptions,

@robertrossmann robertrossmann merged commit d2b3242 into strvcom:master Nov 7, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants