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
(Fares droubi)
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
(Fares droubi)
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
(Fares droubi)
September 13, 2022, 6:20pm
7
Ok, I'm checking with our dev team, and I will get back to you.
Fares
(Fares droubi)
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
(Fares droubi)
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