This module is declared with 'export =', and can only be used with a default import when using the '
Unanswered
Irish Wolfhound posted this in #help-forum
Irish WolfhoundOP
I get an error when checking the code with the
Full error text in the attached file
The file in which the error occurs:
tsc --pretty --noEmit command (lint-staged) Full error text in the attached file
The file in which the error occurs:
import { cookies } from 'next/headers';
import type { Session, User } from 'lucia';
type ValidateSession = { user: User; session: Session } | { user: null; session: null };
export const validateSession = async (): Promise<ValidateSession> => {
return JSON.parse(JSON.stringify('result'));
};2 Replies
Irish WolfhoundOP
Configuration files:
// .lintstagedrc.js
module.exports = {
'*.(js|jsx|ts|tsx)': 'eslint --cache',
'*.{ts,tsx}': 'tsc --pretty --noEmit',
'*': 'prettier --check',
};// tsconfig.json
{
"compilerOptions": {
"target": "ESNext",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"noEmit": true,
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"plugins": [
{
"name": "next"
}
]
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules", "**/*._backup*", "**/*._legacy*", "**/*._temp*", "**/*._labs*"],
"extends": "./tsconfig.paths.json"
}//package.json
"dependencies": {
"@formatjs/intl-localematcher": "^0.5.2",
"@hookform/resolvers": "^3.3.4",
"@lucia-auth/adapter-mongodb": "^1.0.3",
"@mantine/carousel": "^7.8.1",
"@mantine/core": "^7.8.1",
"@mantine/hooks": "^7.8.1",
"@mantine/notifications": "^7.8.1",
"@uploadthing/react": "^6.0.2",
"ameliance-scripts": "^0.2.4",
"argon2": "^0.40.1",
"embla-carousel-react": "^7.1.0",
"jsonwebtoken": "^9.0.2",
"lucia": "^3.2.0",
"mongoose": "^8.3.0",
"negotiator": "^0.6.3",
"next": "^14.2.3",
"nodemailer": "^6.9.13",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-hook-form": "^7.47.0",
"uploadthing": "^6.0.3",
"zod": "^3.22.4",
"zustand": "^4.4.6"
},
"devDependencies": {
"@types/jsonwebtoken": "^9.0.6",
"@types/negotiator": "^0.6.3",
"@types/node": "^20",
"@types/nodemailer": "^6.4.14",
"@types/react": "^18.3.2",
"@types/react-dom": "^18.3.0",
"@typescript-eslint/eslint-plugin": "^6.9.0",
"eslint": "^8",
"eslint-config-next": "14.0.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-simple-import-sort": "^10.0.0",
"husky": "^8.0.3",
"lint-staged": "^15.0.2",
"postcss": "^8.4.38",
"postcss-preset-mantine": "^1.15.0",
"postcss-simple-vars": "^7.0.1",
"prettier": "^3.0.3",
"sass": "^1.69.5",
"typescript": "^5.4.5"
}