Skip to content

Commit 9f4b1cc

Browse files
committed
fix(ts): remove verbatimModuleSyntax
1 parent 654e9bd commit 9f4b1cc

File tree

2 files changed

+31
-3
lines changed

2 files changed

+31
-3
lines changed

docs/decisions/005-verbatim-module-syntax.md

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,37 @@
1-
# Title
1+
# verbatimModuleSyntax
22

33
Date: 2024-05-30
44

5-
Status: accepted
5+
Status: deprecated
6+
7+
Deprecation date: 2024-05-31
8+
9+
## Deprecation Note
10+
11+
Turns out in Remix that `verbatimModuleSyntax` will cause issues if you try to
12+
import a `type` from a `.server` file into a non `.server` file. Like what we do
13+
in the Epic Stack for our toast utilities:
14+
15+
```ts
16+
import { useEffect } from 'react'
17+
import { toast as showToast } from 'sonner'
18+
import { type Toast } from '#app/utils/toast.server.ts' // <-- the build is very unhappy about this with verbatimModuleSyntax
19+
20+
export function useToast(toast?: Toast | null) {
21+
useEffect(() => {
22+
if (toast) {
23+
setTimeout(() => {
24+
showToast[toast.type](toast.title, {
25+
id: toast.id,
26+
description: toast.description,
27+
})
28+
}, 0)
29+
}
30+
}, [toast])
31+
}
32+
```
33+
34+
For that reason, this has been removed from the config.
635

736
## Context
837

typescript.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
"skipLibCheck": true,
1010
"allowImportingTsExtensions": true,
1111
"noUncheckedIndexedAccess": true,
12-
"verbatimModuleSyntax": true,
1312
"noEmit": true
1413
}
1514
}

0 commit comments

Comments
 (0)