DEV Community

Discussion on: The TypeScript Experience

 
brense profile image
Rense Bakker

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.ts
declare module 'components' {
  export const OldComponent:any
  // or just give it a proper type asuming its a react component?
  export const OldComponent:() => JSX.Element
}
Enter fullscreen mode Exit fullscreen mode