Skip to content

After upgrading from 4.8.2 to 4.9.4, the type extension of third-party libraries becomes invalid. #55518

Closed as not planned
@JaneSu

Description

@JaneSu

🔎 Search Terms

  • typescript type extends of third party
  • d.ts not working

🕗 Version & Regression Information

There was no such issue in 4.8.4, but it was found that the extension of d.ts became invalid from 4.9.1-rc onwards, and this issue persists in subsequent versions.

⏯ Playground Link

No response

💻 Code

// page.tsx
import {useSelector} from 'react-redux

export const Page = ()=>{
  const name = useSelector(state=>state.name)
  return <div>test, { name }</div>
}
// index.d.ts
import 'react-redux'

declare module 'react-redux' {
  export function useSelector<any, any>(selector: (state: any) => any, equalityFn?: EqualityFn<any> | undefined): any
}

🙁 Actual behavior

The type definition used by useSelector is still from react-redux internally.

CleanShot 2023-08-26 at 16 52 35@2x

🙂 Expected behavior

useSelector uses the types defined in my d.ts file. Just like it performed in 4.8.4

Additional information about the issue

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Working as IntendedThe behavior described is the intended behavior; this is not a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions