-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Open
Labels
Awaiting More FeedbackThis means we'd like to hear from more people who would be helped by this featureThis means we'd like to hear from more people who would be helped by this featureSuggestionAn idea for TypeScriptAn idea for TypeScript
Description
TypeScript Version: 3.9.3
Search Terms:
TypeScript along side JavaScript
Code
Button.jsx
const Button = ({ text, onClick }) => {
return <button onClick={onClick}>{text}</button>
}Button.d.ts
interface Props {
text: string
onClick: () => void
}
declare const Button: (props: Props) => ElementExpected behavior:
TypeScript should apply the types described in Button.d.ts and use them on Button.jsx.
Actual behavior:
The prop types in Button.jsx are any and are ignoring the typed written in Button.d.ts.
Playground Link: https://codesandbox.io/s/loving-mclaren-dvefd?file=/src/button/Button.jsx
Related Issues: https://stackoverflow.com/questions/53074172/typescript-declaration-files-for-local-js-files
Other Info:
I made a stackoverflow question about this but it doesn't seem to be known there. https://stackoverflow.com/questions/61932377/use-typescript-declaration-files-alongside-javascript
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Awaiting More FeedbackThis means we'd like to hear from more people who would be helped by this featureThis means we'd like to hear from more people who would be helped by this featureSuggestionAn idea for TypeScriptAn idea for TypeScript