vaadin / hilla

Build better business applications, faster. No more juggling REST endpoints or deciphering GraphQL queries. Hilla seamlessly connects Spring Boot and React to accelerate application development.
https://hilla.dev
Apache License 2.0
895 stars 56 forks source link

verbatimModuleSyntax in tsconfig causes problems with generated files #1260

Open Artur- opened 12 months ago

Artur- commented 12 months ago

Description of the bug

If you turn on verbatimModuleSyntax in your tsconfig.json, you start seeing errors from the generated files such as

src/types/dev/hilla/mappedtypes/Pageable.ts:7:16 - error TS1284: An 'export default' must reference a value when 'verbatimModuleSyntax' is enabled, but 'Pageable' only refers to a type.

7 export default Pageable;

src/crud.ts:1:8 - error TS1484: 'Pageable' is a type and must be imported using a type-only import when 'verbatimModuleSyntax' is enabled.

import Pageable from './types/dev/hilla/mappedtypes/Pageable';

Minimal reproducible example

Starter + edit tsconfig.json

Expected behavior

It should work

Versions:

- Vaadin / Hilla version: 2.2
Lodin commented 11 months ago

I guess we should switch to .d.ts instead of regular .ts for interfaces since they won't produce any JS code. That'll fix this issue and will be more TS-friendly