-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
fix(ts): Suppress ts errors on Editor.tsx #11275
base: master
Are you sure you want to change the base?
Conversation
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Where are these TS errors coming from? I am not seeing these errors locally. Once we understand where this is coming from, we can decide whether to accept. Cheers |
new ImageExtension({ enableResizing: !readOnly }), | ||
new ItalicExtension(), | ||
new LinkExtension({ autoLink: true, defaultTarget: '_blank' }), | ||
new ListItemExtension(), | ||
new ListItemExtension({}), | ||
new MarkdownExtension({ htmlSanitizer: DOMPurify.sanitize, htmlToMarkdown, markdownToHtml }), | ||
new OrderedListExtension(), | ||
new UnderlineExtension(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not do this for all of these?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Errors did not come for others.
@@ -50,26 +50,26 @@ export const Editor = forwardRef((props: EditorProps, ref) => { | |||
const { manager, state, getContext } = useRemirror({ | |||
extensions: () => [ | |||
new BlockquoteExtension(), | |||
new BoldExtension(), | |||
new BulletListExtension(), | |||
new BoldExtension({}), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even in the Remirror docs, they are not using an empty in constructor for these extensions: https://remirror.io/docs/extensions/bold-extension
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is the link of an online editor, using the same version of packages. Showing the error:
https://stackblitz.com/edit/vitejs-vite-z3rg1l?file=src%2FEditor.tsx
(You need to wait till yarn install is complete, then the tsx error will start showing)
Hi @jjoyce0510, This is the snap of the error from my local. Thanks ! |
@pinakipb2, @jjoyce0510 From: https://github.com/remirror/remirror/blob/main/packages/remirror__types/src/types.ts#L106 An alternative to usage of
|
Checked the Type declaration files and found:Passing The error is not coming for some of the other types because: In some places, remirror is using An alternative to usage of {} as a type.This is working as expected, as this is the default value and when generic is not passed, no ts errors are seen. But when a generic type is passed (even an empty interface), ts gives error for required constructor. Maybe its an issue with remirror types with how they are inferring the generic or as @rtekal mentioned, IDE or Lint is not able to figure out types. |
Checklist