framesjs/frames.js

Type error: /app/examples/new-api-multi-protocol/frames.ts:9:14

Closed this issue · 7 comments

Getting this error when trying to deploy on vercel.

/app/examples/new-api-multi-protocol/frames.ts:9:14

Type error: The inferred type of 'frames' cannot be named without a reference to '../../../node_modules/frames.js/dist/types-FlFAuYva'. This is likely not portable. A type annotation is necessary.
7 | import { DEFAULT_DEBUGGER_HUB_URL } from "../../debug";
8 |

9 | export const frames = createFrames({
| ^
10 | basePath: "/examples/new-api-multi-protocol",
11 | initialState: {
12 | pageIndex: 0,
Error: Command "npm run build" exited with 1

Thanks for reporting. Would you mind sharing your tsconfig.json, typescript version, and frames.js version? I have a draft solution in #353 which i suspect will fix the issue, but would like to try to reproduce it

{
"$schema": "https://json.schemastore.org/tsconfig",
"display": "Default",
"compilerOptions": {
"declaration": true,
"declarationMap": true,
"esModuleInterop": true,
"incremental": false,
"isolatedModules": true,
"lib": [
"es2022",
"DOM",
"DOM.Iterable"
],
"module": "ESNext",
"moduleDetection": "force",
"moduleResolution": "Bundler",
"noEmit": true,
"noUncheckedIndexedAccess": true,
"plugins": [
{
"name": "next",
},
],
"paths": {
"@/": [
"./@/
"
]
},
"jsx": "preserve",
"resolveJsonModule": true,
"skipLibCheck": true,
"strict": true,
"target": "ES2022",
"allowJs": true,
},
"include": [
"next-env.d.ts",
"next.config.js",
"/*.ts",
"
/.tsx",
".next/types/**/
.ts",
],
"exclude": [
"node_modules"
],
}

"typescript": "^5.3.3"

"frames.js": "^0.9.3",

This seems to be outdated version of frames.js. Could you try upgrading to latest version (0.15.1)?

Upgrading unblocked me for awhile.
This 'frames' is throwing similar error

Upgrading unblocked me for awhile. This 'frames' is throwing similar error

@i001962 is that in the same project as the original error? Doesn't look like it should be happening since the upgrade to 0.15.1 fixed the issue and the package is same for whole project.

I also tried creating fresh project using yarn create frames and wasn't able to reproduce the issue. @i001962 would you mind sharing the second error you are getting?

This is caused by combination of typescript 5.3.3 and declaration,declarationMap options in tsconfig.json. By upgrading to newer typescript (at the moment 5.4.5) or removing the mentioned options from tsconfig.json the error goes away.