Skip to content

Commit

Permalink
fix(ts): remove verbatimModuleSyntax
Browse files Browse the repository at this point in the history
  • Loading branch information
kentcdodds committed May 31, 2024
1 parent 654e9bd commit 9f4b1cc
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 3 deletions.
33 changes: 31 additions & 2 deletions docs/decisions/005-verbatim-module-syntax.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,37 @@
# Title
# verbatimModuleSyntax

Date: 2024-05-30

Status: accepted
Status: deprecated

Deprecation date: 2024-05-31

## Deprecation Note

Turns out in Remix that `verbatimModuleSyntax` will cause issues if you try to
import a `type` from a `.server` file into a non `.server` file. Like what we do
in the Epic Stack for our toast utilities:

```ts
import { useEffect } from 'react'
import { toast as showToast } from 'sonner'
import { type Toast } from '#app/utils/toast.server.ts' // <-- the build is very unhappy about this with verbatimModuleSyntax
export function useToast(toast?: Toast | null) {
useEffect(() => {
if (toast) {
setTimeout(() => {
showToast[toast.type](toast.title, {
id: toast.id,
description: toast.description,
})
}, 0)
}
}, [toast])
}
```

For that reason, this has been removed from the config.

## Context

Expand Down
1 change: 0 additions & 1 deletion typescript.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
"skipLibCheck": true,
"allowImportingTsExtensions": true,
"noUncheckedIndexedAccess": true,
"verbatimModuleSyntax": true,
"noEmit": true
}
}

0 comments on commit 9f4b1cc

Please sign in to comment.