-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Description
Provide a general summary of the issue here
This is because it is written as:
type SlottedContextValue<T> = SlottedValue<T> | T | null | undefined;
export type ContextValue<T, E> = SlottedContextValue<WithRef<T, E>>;Looking at the type, my guess is SlottedContextValue should be:
type SlottedContextValue<T> = SlottedValue<T> & T | null | undefined;May be a mistake?
I can open a PR for it.
π€ Expected Behavior?
Autocompletion should be available to the value of type ContextValue<T, E>.
type MyProps = { a: string }
type MyContextValue = ContextValue<MyCompProps, HTMLDivElement>
const MyContext = createContext<MyContextValue>(null)
function Comp() {
return (
<MyContext.Consumer>
{(context) => {
// autocompletion is not available
console.log(context.a)
return <div>{context}</div>
}}
</MyContext.Consumer>
)
}π― Current Behavior
see above
π Possible Solution
see above
π¦ Context
No response
π₯οΈ Steps to Reproduce
See above
Version
1.14.0
What browsers are you seeing the problem on?
Other
If other, please specify.
code
What operating system are you using?
macos
π§’ Your Company/Team
Palo Alto Networks
π· Tracking Issue
No response
Metadata
Metadata
Assignees
Labels
No labels