0

What is the proper type when using an imported icon (e.g. SVG) in TypeScript

import icon_name from './icon_file.svg'

function icon(): MISSING_TYPE
{
  return icon_name;
}

I am particularly interested in React but I don't feel React.ReactNode is appropriate.

1 Answers1

0

In your function this is only one return possibility? In typescript is type inference, so compiler specify returned type by itself.

Btw solution is here: What is the type of the <svg> element in typescript

CubeStorm
  • 138
  • 6