Skip to content

refactor(lint): replace any and tighten type idioms#471

Merged
mrholek merged 1 commit into
mainfrom
fix/lint-types-idioms
Jun 13, 2026
Merged

refactor(lint): replace any and tighten type idioms#471
mrholek merged 1 commit into
mainfrom
fix/lint-types-idioms

Conversation

@mrholek

@mrholek mrholek commented Jun 13, 2026

Copy link
Copy Markdown
Member

Part of bringing yarn lint to zero (follow-up to #468/#469/#470). Library type & idiom cleanups — no behavior change.

Changes

  • table/Column._style: anyCSSProperties.
  • CDropdownToggle / CCarousel cloneElement targets: ReactElement<any>ReactElement<Record<string, unknown>>.
  • executeAfterTransition handler arg: { target }: { target: any }{ target }: Event.
  • isFunction: replaced the Object.prototype.toString lookup with a typeof value === 'function' check and a precise type guard — clears ban-types, no-unsafe-function-type, and prefer-prototype-methods at once.
  • polymorphicComponent: empty interface Props extends AsProp {}type Props = AsProp (no-empty-object-type).
  • table/utils replace(/…/g)replaceAll; mergeClassNames obj.hasOwnPropertyObject.hasOwn (both already supported — tsconfig lib is es2023).
  • CFocusTrap test helper index signature: anyunknown.

Deliberately scoped

  • useForkedRef keeps its variadic refs dependency list with a line-scoped react-hooks/use-memo disable + comment. The rule requires a static array-literal dep list, which a variadic-arity hook cannot provide; dropping useMemo would reintroduce the ref detach/reattach churn from Share ref with multiple ref handlers react/react#13029. This is a tooling limitation, not a hidden issue.
  • table/Item's [key: string]: … | any is left as-is. Its values are rendered as React children ({item[colName]}) while the same shape carries object meta-keys (_props/_cellProps); tightening it is a public-API typing decision deferred to its own change.

Verification

  • tsc --noEmit clean, yarn lib:build succeeds (validates replaceAll/Object.hasOwn).
  • Full suite: 127 suites / 360 tests green, no snapshot changes.

- type table Column._style as CSSProperties
- type the cloneElement targets in CDropdownToggle and CCarousel as
  ReactElement<Record<string, unknown>> instead of ReactElement<any>
- type the executeAfterTransition handler argument as Event
- simplify isFunction to a typeof check, dropping the Function type and the
  Object.prototype.toString lookup (fixes ban-types, no-unsafe-function-type,
  prefer-prototype-methods)
- convert the empty Props interface to a type alias (no-empty-object-type)
- use replaceAll and Object.hasOwn in table/utils and mergeClassNames
- type the CFocusTrap test helper index signature as unknown

useForkedRef keeps its variadic dependency list with a scoped disable: the
deps cannot be a static array literal and dropping useMemo would reintroduce
the ref detach/reattach churn from react/react#13029.

The public Item index signature any is left for a dedicated typing decision.
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.

1 participant