webadmin
(Eric)
August 31, 2022, 8:16pm
1
My project is a nextjs typescript project with the following package.json
excerpt:
{
// ...
"dependencies": {
// ...
"@prismicio/client": "^6.4.2",
"@prismicio/helpers": "^2.3.3",
"@prismicio/next": "^0.1.2",
"@prismicio/react": "^2.2.0",
"@prismicio/slice-simulator-react": "^0.2.1",
},
"devDependencies": {
"@babel/core": "^7.18.2",
"@types/node": "17.0.23",
"@types/react": "17.0.43",
"@types/react-dom": "17.0.14",
"@prismicio/types": "^0.2.3",
"typescript": "4.6.3",
"slice-machine-ui": "^0.3.8",
// ....
},
"resolutions": {
"@types/react": "17.0.30"
}
}
I'm getting this error upon yarn build
:
app:build: ../../node_modules/@prismicio/helpers/dist/index.d.ts:386:2
app:build: Type error: '?' expected.
app:build:
app:build: 384 | embed_url: string;
app:build: 385 | html: string | null;
app:build: > 386 | }) ? {
app:build: | ^
app:build: 387 | [x: string]: never;
app:build: 388 | } | (Data & {
app:build: 389 | embed_url: string;
Any suggestions?
1 Like
webadmin
(Eric)
August 31, 2022, 8:17pm
2
Would like to point out my tsconfig.json
is as follows:
(i am excluding node_modules
)
{
"extends": "tsconfig/nextjs.json",
"compilerOptions": {},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"]
}
Fares
September 2, 2022, 1:45pm
4
Hi @webadmin
Thanks for reaching out.
For your reference, It seems that it is the same issue as this one
I'm still not sure about the fix, I will do some research and get back to you.
Fares
September 2, 2022, 1:47pm
5
It seems that updating your TypeScript to the latest version should solve the issue. Can you try and let us know?
Hi there, to touch base on this, we still have this problem.
Working:
βββ @prismicio /client@6.5.1
βββ @prismicio /helpers@2.3.0
βββ @prismicio /types@0.1.27
βββ apollo-link-prismic@1.1.1
βββ prismic-dom@2.2.7
βββ typescript@4.8.3
Upgrading, breaks:
TypeScript
βββ @prismicio /client@6.7.1
βββ @prismicio /helpers@2.3.3
βββ @prismicio /types@0.2.3
βββ apollo-link-prismic@1.1.1
βββ prismic-dom@2.2.7
βββ typescript@4.8.3
Using @stencil /core@2.17.4 but it should have any impact
tsconfig.json
{
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"allowUnreachableCode": false,
"declaration": false,
"experimentalDecorators": true,
"lib": [
"dom",
"es2019"
],
"moduleResolution": "node",
"module": "esnext",
"target": "es2017",
"noUnusedLocals": true,
"noUnusedParameters": true,
"jsx": "react",
"jsxFactory": "h",
"resolveJsonModule" : true,
"removeComments": true,
"skipLibCheck": true
},
"include": [
"src"
],
"exclude": [
"node_modules"
]
}
Fares
September 13, 2022, 6:20pm
7
Ok, I'm checking with our dev team, and I will get back to you.
Fares
September 14, 2022, 3:30pm
9
Hi, well, I've checked with our dev team, and for us upgrading TypeScript should have fixed the issue, but itβs possible you have multiple versions of TypeScript installed.
The wrong version might be used to build the website.
We have written a fix for @prismicio/helpers
that should solve this issue regardless of TypeScript versions, but itβll need to be reviewed before merging and publishing. We should be able to publish a fix in the next week or 2.
1 Like
Ok, thanks. No, I am using the right version used in the package.json, no global installation
Could you let me know how I could trace when the fix is released ?
Seems last helpers update solved the issue @Pau @Fares
βββ @prismicio /client@6.7.1
βββ @prismicio /helpers@2.3.4
βββ @prismicio /next@0.1.5
βββ @prismicio /react@2.5.0
βββ @prismicio /slice-simulator-react@0.2.2
βββ @prismicio /types@0.2.3
βββ @tailwindcss /aspect-ratio@0.4.2
βββ autoprefixer@10.4.11
βββ clsx@1.2.1
βββ concurrently@7.4.0
βββ eslint-config-next@12.3.1
βββ eslint@8.23.1
βββ flag-icons@6.6.6
βββ next@12.3.1
βββ node-fetch@3.2.10
βββ postcss@8.4.16
βββ prettier-plugin-tailwindcss@0.1.13
βββ prettier@2.7.1
βββ prismic-ts-codegen@0.1.5
βββ react-dom@18.2.0
βββ react@18.2.0
βββ slice-machine-ui@0.4.2
βββ tailwindcss@3.1.8
1 Like
Fares
September 21, 2022, 11:02am
12
Yes, effectively, Updating to the latest version, v2.3.5
should solve the issue.
npm install @prismicio/helpers@latest
If that doesn't work, they may need to update @prismicio/helpers
in dependencies as well:
npm update @prismicio/helpers@latest