Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BlockNoteView component expects at least '5' arguments, but the JSX factory 'React.createElement' provides at most '2' #1211

Closed
1 task
BranonConor opened this issue Nov 3, 2024 · 13 comments
Labels
bug Something isn't working

Comments

@BranonConor
Copy link

Describe the bug
When pulling latest Blocknote into my project and slapping in a BlockNoteView component like the examples on the docs, I get a linter warning that says 'BlockNoteView expects at least '5' arguments, but the JSX factory 'React.createElement' provides at most '2'.

Interestingly as well, when pushing to Vercel for deployment I get a completely different build error, around a TS problem where the editor prop apparently doesn't exist at all on the BlockNoteView component 🤔

To Reproduce
Pull latest Blocknote, create a simple component like the docs, and render a BlockNoteView component with the editor prop.

My project is here, for reference with its configurations/etc: https://github.com/BranonConor/list-rocket
This is the BlockNote editor component I created here.

Screenshot of the warning

Screenshot 2024-11-02 at 5 22 20 PM

Misc

  • Node version: 18^
  • Package manager: yarn
  • Browser: Chrome
  • I'm a sponsor and would appreciate if you could look into this sooner than later 💖
@BranonConor BranonConor added the bug Something isn't working label Nov 3, 2024
@BranonConor
Copy link
Author

Also - here's the screenshot of my Vercel logs, since that error is slightly different.
Screenshot 2024-11-02 at 5 36 58 PM

@BranonConor
Copy link
Author

I also tried adding Blocknote to this project of mine and I'm seeing the same bug :/ This project has much more recent versions of NextJS, React, etc. fwiw

@BranonConor
Copy link
Author

And sorry to blow this thread up but more experimentation - I installed my ListRocket project fresh on a different machine, yarn'd, etc. in my blocknote branch and now I see the type error as listed above^ in the screenshot. editor field doesn't exist on the BlockNoteView component.

If I TS Ignore that and try to build, then it gets stuck on a different error:

PS C:\Users\brano\code\list-rocket2> yarn build
yarn run v1.22.22
$ next build
info  - Loaded env from C:\Users\brano\code\list-rocket2\.env
Failed to compile.

./node_modules/@blocknote/react/types/src/schema/ReactBlockSpec.d.ts:21:46
Type error: Type parameter declaration expected.

  19 |     children: ReactNode;
  20 | }): import("react/jsx-runtime").JSX.Element;
> 21 | export declare function createReactBlockSpec<const T extends CustomBlockConfig, const I extends InlineContentSchema, const S extends StyleSchema>(blockConfig: T, blockImplementation: ReactCustomBlockImplementation<T, I, S>): {
     |                                              ^
  22 |     config: T;
  23 |     implementation: import("@blocknote/core").TiptapBlockImplementation<T, any, InlineContentSchema, StyleSchema>;
  24 | };
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

@YousefED
Copy link
Collaborator

YousefED commented Nov 3, 2024 via email

@BranonConor
Copy link
Author

Thanks for taking a look so quickly @YousefED ! 🙏 I bumped TS in my project to ^5, which did fix the jsx factory error and I'm not seeing that same warning I was seeing elsewhere, in the build logs for Vercel, etc. around the editor prop not existing on the BlockNoteView component. 🤔

Screenshot 2024-11-03 at 9 06 07 AM

@YousefED
Copy link
Collaborator

you shouldn't need to as BlockNoteEditor, can you remove that?

@dr-dark-flames
Copy link

facing the same error

Thanks for taking a look so quickly @YousefED ! 🙏 I bumped TS in my project to ^5, which did fix the jsx factory error and I'm not seeing that same warning I was seeing elsewhere, in the build logs for Vercel, etc. around the editor prop not existing on the BlockNoteView component. 🤔
Screenshot 2024-11-03 at 9 06 07 AM

@YousefED
Copy link
Collaborator

YousefED commented Dec 11, 2024 via email

@dr-dark-flames
Copy link

"dependencies": {
"@blocknote/core": "^0.20.0",
"@blocknote/mantine": "^0.20.0",
"@blocknote/react": "^0.20.0",
"@clerk/nextjs": "^6.9.0",
"@hookform/resolvers": "^3.9.1",
"@radix-ui/react-accordion": "^1.2.1",
"@radix-ui/react-alert-dialog": "^1.1.2",
"@radix-ui/react-aspect-ratio": "^1.1.0",
"@radix-ui/react-avatar": "^1.1.1",
"@radix-ui/react-checkbox": "^1.1.2",
"@radix-ui/react-dialog": "^1.1.2",
"@radix-ui/react-dropdown-menu": "^2.1.2",
"@radix-ui/react-label": "^2.1.0",
"@radix-ui/react-navigation-menu": "^1.2.1",
"@radix-ui/react-progress": "^1.1.0",
"@radix-ui/react-select": "^2.1.2",
"@radix-ui/react-separator": "^1.1.0",
"@radix-ui/react-slot": "^1.1.0",
"@radix-ui/react-tabs": "^1.1.1",
"@radix-ui/react-toast": "^1.2.2",
"@radix-ui/react-tooltip": "^1.1.4",
"@tanstack/react-table": "^8.20.5",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"convex": "^1.17.3",
"date-fns": "^4.1.0",
"embla-carousel-react": "^8.5.1",
"lucide-react": "^0.468.0",
"next": "15.1.0",
"next-themes": "^0.4.4",
"query-string": "^9.1.1",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"react-hook-form": "^7.54.0",
"sonner": "^1.7.1",
"stripe": "^17.4.0",
"tailwind-merge": "^2.5.5",
"tailwindcss-animate": "^1.0.7",
"usehooks-ts": "^3.1.0",
"zod": "^3.24.1",
"zustand": "^5.0.2"
},
"devDependencies": {
"@types/node": "^22.10.1",
"@types/react": "^19.0.1",
"@types/react-dom": "^19.0.2",
"autoprefixer": "^10.4.20",
"eslint": "^9.16.0",
"eslint-config-next": "15.1.0",
"postcss": "^8.4.49",
"tailwindcss": "^3.4.16",
"typescript": "^5.7.2"
}

@YousefED
Copy link
Collaborator

YousefED commented Dec 11, 2024 via email

@dr-dark-flames
Copy link

basic example found in the docs

@dr-dark-flames
Copy link

pretty sure it has smth to do with exporting the prop editor and its type

@YousefED
Copy link
Collaborator

closed by #1316

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants