Skip to content

Typings for RAC Keyboard #9666

@artola

Description

@artola

Provide a general summary of the issue here

The recently added KeyboardProps is not used in KeyboardContext neither in the component signature.

export interface KeyboardProps extends HTMLAttributes<HTMLElement>, DOMRenderProps<'kbd', undefined> {}

🤔 Expected Behavior?

KeyboardProps is passed for context and props.

😯 Current Behavior

KeyboardProps is not used, and then for example the new render can not be passed using the context or as prop.

💁 Possible Solution

It seems that KeyboardProps should be used in both:

export const KeyboardContext = createContext<ContextValue<KeyboardProps, HTMLElement>>({});

export const Keyboard = forwardRef(function Keyboard(props: KeyboardProps, ref: ForwardedRef<HTMLElement>) {

🔦 Context

JS works, but TS does not properly show the types for the render.

🖥️ Steps to Reproduce

https://codesandbox.io/p/sandbox/exciting-fire-2jz7r2?file=%2Fsrc%2FApp.js%3A7%2C1

Version

RAC 1.15.1

What browsers are you seeing the problem on?

Chrome

If other, please specify.

No response

What operating system are you using?

OSX

🧢 Your Company/Team

No response

🕷 Tracking Issue

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions