Not sure how that is possible? Afaik if you can import your untyped js code like that, typescript is going to infer types from it as well... If it's an untyped module and type inference is not possible for some reason, you can use something like this:
// components.d.tsdeclaremodule'components'{exportconstOldComponent:any// or just give it a proper type asuming its a react component?exportconstOldComponent:()=>JSX.Element}
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Because
OldComponent
is not typed (and we don't want to type it now), so it creates problem with types of children, spread props etc.Not sure how that is possible? Afaik if you can import your untyped js code like that, typescript is going to infer types from it as well... If it's an untyped module and type inference is not possible for some reason, you can use something like this: