Skip to content

[RFR] Enable noImplicitAny in ra-input-rich-text - #11455

Open
shikhar1est wants to merge 1 commit into
marmelab:masterfrom
shikhar1est:fix/no-implicit-any-ra-input-rich-text
Open

shikhar1est wants to merge 1 commit into
marmelab:masterfrom
shikhar1est:fix/no-implicit-any-ra-input-rich-text

Conversation

@shikhar1est

Copy link
Copy Markdown

Problem

Part of #11426 — enabling TypeScript's noImplicitAny compiler option across react-admin packages.

Solution

  • Enabled "noImplicitAny": true in packages/ra-input-rich-text/tsconfig.json.
  • Typed the action lookup maps (AlignmentActions, FormatActions, ListActions) as Record<string, (editor: Editor) => boolean> in the toolbar button components to resolve TS7053 index-signature errors.
  • Added explicit parameter types in RichTextInput.stories.tsx without altering any public component or hook signatures.

How To Test

  • yarn tsc --noEmit -p packages/ra-input-rich-text
  • yarn jest packages/ra-input-rich-text
  • yarn workspace ra-input-rich-text build

Additional Checks

  • The PR targets master for a bugfix or a documentation fix, or next for a feature
  • The PR includes unit tests (existing RichTextInput.spec.tsx covers the modified components; no runtime behavior was changed)
  • The PR includes one or several stories (existing RichTextInput.stories.tsx covers the components and was updated with explicit types)
  • The documentation is up to date

Also, please make sure to read the contributing guidelines.

);
};
const suggestions = tags => {
const suggestions = (tags: string[]) => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you type suggestions with tiptap SuggestionOptions type, you can remove all subsequent explicit any:

Suggested change
const suggestions = (tags: string[]) => {
const suggestions: Omit<SuggestionOptions<string>, 'editor'> = (tags: string[]) => {

"outDir": "dist",
"rootDir": "src",
"allowJs": false,
"noImplicitAny": true

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also set strict true here, and update type accordingly.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants