You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
TypeScript native / TS 6+ (Next 16) – TS1540 on declare module slugify in slugify.d.ts #205
Hi, thanks team slugify – i'm using it in a Next.js 16 monorepo with the new TypeScript “native” compiler, and am running into a hard TS error from the bundled .d.ts.
Error
With slugify@1.6.6 and the native TypeScript compiler (via @typescript/native-preview), I consistently get:
ts
../../node_modules/.bun/slugify@1.6.6/node_modules/slugify/slugify.d.ts:1:16 - error TS1540: A 'namespace' declaration should not be declared using the 'module' keyword. Please use the 'namespace' keyword instead.
1 declare module slugify
This happens even with skipLibCheck: true – it appears to be treated as a syntax / deprecation error in the newer compiler rather than a regular lib type error.
Those cover callability/interop; this one is specifically about the declare module slugify syntax becoming a hard error under the newer compiler.
What would help
Updating the declaration file to use the modern form (e.g. declare namespace or an ES module style) so it doesn’t trigger TS1540 under TS 6+ / @typescript/native-preview.
Alternatively, a patch/minor release with updated .d.ts that’s compatible with Next.js 16’s default TypeScript toolchain.
In the meantime I can work around this by shadowing the types or patching slugify.d.ts locally, but having an official fix in the package would make life a lot easier for projects on the new TS compiler.
If anyone knows if the slug module has the same problem or not, I'd appreciate a heads up. (I help maintain slugify here and there, but I'm the sole maintainer of slug.) I was unable to reproduce the issue on slugify with the minimal reproduction provided by OP here, but I assume that's because I was missing something simple about the setup that is implied and was going to get around to figuring that out yesterday, and then the day got away from me.
Hi, sorry if this issue is incomplete it's my first issue outside of my own account. Here is a link to my repo: firstroad. If that helps? Running bun type at the root - it's a Monorepo - triggers the typescript issue in the utils package where slugify is installed. This issue only happens for fairly recent versions of tsgo as it didn't use to occur before a recent update.
If anyone knows if the slug module has the same problem or not, I'd appreciate a heads up. (I help maintain slugify here and there, but I'm the sole maintainer of slug.) I was unable to reproduce the issue on slugify with the minimal reproduction provided by OP here, but I assume that's because I was missing something simple about the setup that is implied and was going to get around to figuring that out yesterday, and then the day got away from me.
I have looked at the @types/slug and it uses namespace instead of module so I think it's likely your package is okay
I have looked at the @types/slug and it uses namespace instead of module so I think it's likely your package is okay
slug is a more-or-less drop in replacement for slugify so switching to slug is an option too (although it does look like the fix for slugify is a one-liner and should likely see a quick merge-and-release).
Reacted by Coinnich, Obed Parlapiano and rubiesonthesky
Activity
Scalahansolo commentedon Feb 26, 2026
I ran into this yesterday as well. Was going to open a PR in this repo today and hope it gets merged. It's a one line change.
Here is the patch I have applied locally for now to move my repos forward.
Trott commentedon Feb 26, 2026
If anyone knows if the
slugmodule has the same problem or not, I'd appreciate a heads up. (I help maintainslugifyhere and there, but I'm the sole maintainer ofslug.) I was unable to reproduce the issue onslugifywith the minimal reproduction provided by OP here, but I assume that's because I was missing something simple about the setup that is implied and was going to get around to figuring that out yesterday, and then the day got away from me.fringe4life commentedon Feb 26, 2026
Hi, sorry if this issue is incomplete it's my first issue outside of my own account. Here is a link to my repo: firstroad. If that helps? Running bun type at the root - it's a Monorepo - triggers the typescript issue in the utils package where slugify is installed. This issue only happens for fairly recent versions of tsgo as it didn't use to occur before a recent update.
fringe4life commentedon Feb 26, 2026
As for the slug package I am not sure. You would need to install a recent version of tsgo or maybe typescript 6 beta to test it out.
fringe4life commentedon Feb 27, 2026
link to typescript 6 beta release
fringe4life commentedon Feb 27, 2026
Works for me as well
fringe4life commentedon Feb 27, 2026
I have looked at the @types/slug and it uses namespace instead of module so I think it's likely your package is okay
Update slugify.d.ts per simov#205
Trott commentedon Feb 27, 2026
slugis a more-or-less drop in replacement forslugifyso switching toslugis an option too (although it does look like the fix forslugifyis a one-liner and should likely see a quick merge-and-release).obedparla commentedon Mar 2, 2026
Experienced the same error today when upgrading ts
kongvut commentedon Mar 3, 2026
I've submitted a PR to fix this by replacing the deprecated module keyword with namespace. You can check it out here: #206
Thanks for maintaining this library!
Trott commentedon Mar 13, 2026
Fixed in slugify 1.6.8.