This repository was archived by the owner on Dec 20, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 22
[BUG]: Types not correct #46
Copy link
Copy link
Open
Labels
needs: triageWaiting for a contributor to triageWaiting for a contributor to triagetype: bugSomething isn't workingSomething isn't working
Description
Describe the bug
In order to have typings from next.config, i use @ts-check at the top of the file.
I use next-safe in the following manner:
const nextSafe = require('next-safe');
const secureHeaders = nextSafe({
isDev: process.env.NODE_ENV !== 'production',
contentSecurityPolicy: false, // Will be dynamically set in the app
});and get the following type error on the nextSafe call (but works in runtime since its the suggested way of usage):
(alias) module "next-safe"
import nextSafe
This expression is not callable.
Type 'typeof import("next-safe")' has no call signatures.
The types suggest that this is possible:
const { nextSafe } = require('next-safe');but this fails in runtime/build attempt.
Also, in order to have a dynamic CSP (depending on environment + current page), i use this package in _app.tsx and have the same problem.
Steps To Reproduce
- Create new Next.js app
- Add
@ts-checkin next.config.js or use csp in a.tsxcomponent - Setup
next-safein a recommended way - Start app
- See error
Version
v3.x.x
Relevant log output
No response
Code of Conduct
- I agree to follow this project's Code of Conduct
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
needs: triageWaiting for a contributor to triageWaiting for a contributor to triagetype: bugSomething isn't workingSomething isn't working