Skip to content

BaseCascaderProps fails TS2430 (placement) under exactOptionalPropertyTypes #671

Open

Description

@VishnuPatel9009

With @rc-component/cascader 1.26.0 (resolved by antd 6.7.0), TypeScript 6.0.3, strict, exactOptionalPropertyTypes: true and skipLibCheck: false, the published declaration reports an error on its own (no user code needed):

// index.ts
import type { CascaderProps } from "@rc-component/cascader";
export type Props = CascaderProps;
@rc-component/cascader/es/Cascader.d.ts(25,11): error TS2430: Interface 'BaseCascaderProps<OptionType, ValueField>' incorrectly extends interface 'Omit<BaseSelectPropsWithoutPrivate, "mode" | "showSearch" | "tokenSeparators" | "labelInValue">'.
  Types of property 'placement' are incompatible.
    Type 'Placement | undefined' is not assignable to type 'Placement'.
      Type 'undefined' is not assignable to type 'Placement'.

Cause: es/Cascader.d.ts:58 redeclares placement?: BaseSelectPropsWithoutPrivate['placement'];. Indexed access on the optional base property yields Placement | undefined, while @rc-component/select 1.12.0 declares placement?: Placement. Under exactOptionalPropertyTypes the redeclaration is no longer assignable to the base.

Possible fix: placement?: NonNullable<BaseSelectPropsWithoutPrivate['placement']> (or placement?: Placement).

With exactOptionalPropertyTypes: false the same file compiles with 0 errors. The same declaration file also reports the TS2344 errors tracked in #670.

Versions: @rc-component/cascader 1.26.0, @rc-component/select 1.12.0, antd 6.7.0, TypeScript 6.0.3, @types/react 19.3.0, @types/react-dom 19.3.0, Node 24.21.0.

tsconfig:

{
  "compilerOptions": {
    "target": "ES2024",
    "lib": ["ES2024", "DOM", "DOM.Iterable"],
    "module": "ESNext",
    "moduleResolution": "Bundler",
    "jsx": "react-jsx",
    "strict": true,
    "noUncheckedIndexedAccess": true,
    "exactOptionalPropertyTypes": true,
    "forceConsistentCasingInFileNames": true,
    "isolatedModules": true,
    "verbatimModuleSyntax": true,
    "skipLibCheck": false,
    "noEmit": true,
    "types": ["react", "react-dom"]
  },
  "files": ["index.ts"]
}

Activity

  1. young-tree commented on Nov 19, 2026

    @young-tree

    Opened #672 with the NonNullable<BaseSelectPropsWithoutPrivate['placement']> fix (plus the #670 constraint widening in the same file). Verified with tsc 6.0.3 and 7.0.2 under your tsconfig flags — the TS2430 disappears and the whole package declaration file reports zero errors.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions