How to copy the type of when hovering over the property #471
Replies: 1 comment 3 replies
-
Check the faq in readme
…On Wed, 8 Nov, 2023, 3:15 pm Jakub T. Jankiewicz, ***@***.***> wrote:
I just found that you can hover or click on a prop in React to get the
proper type of prop.
e.g. I have this React Native code:
type VoidFunction = () => void;
type ButtonProps = {
children: ReactNode;
onPress?: VoidFunction;};
const Button: FC<ButtonProps> = ({ children, onPress }) => {
const style = ({pressed}: {pressed: boolean}) => {
return pressed ? [styles.pressable, styles.pressed] : styles.pressable
};
return (
<Pressable onPress={onPress} style={style}>
<View style={styles.container}>
<Text style={styles.text}>{ children }</Text>
</View>
</Pressable>
);};
and I have voidFunction for the type of the onPress handler. But when I
hover or click on the prop I get the proper type of event.
So the question is how I can copy that definition, it appears in the
minibuffer but when I click on the minibuffer it disappears. When I have an
error in TypeScript I often use click and move the keyboard so the error
appears in *messages* buffer, and there was also some function from
flyspell (I think) that showed all the errors, but that will not work with
a type of the thing you hover over.
—
Reply to this email directly, view it on GitHub
<#471>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABEN5XSMKO3BQCRTD5ZKS3YDNICDAVCNFSM6AAAAAA7CSGF5SVHI2DSMVQWIX3LMV43ERDJONRXK43TNFXW4OZVHAZDMOBVG4>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
jcubic
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I just found that you can hover or click on a prop in React to get the proper type of prop. (learned while watching a video when someone used VS Code).
e.g. I have this React Native code:
and I have voidFunction for the type of the onPress handler. But when I hover or click on the prop I get the proper type for that event.
So the question is how I can copy that definition, it appears in the minibuffer but when I click on the minibuffer it disappears. When I have an error in TypeScript I often use click and move the keyboard so the error appears in messages buffer, and there was also some function from flyspell (I think) that showed all the errors, but that will not work with a type of the thing you hover over.
Beta Was this translation helpful? Give feedback.
All reactions