unplugin-icons icon indicating copy to clipboard operation
unplugin-icons copied to clipboard

No ?raw types in react.d.ts

Open RainyPixel opened this issue 3 years ago • 1 comments

Describe the bug

declare module '~icons/*' {
  import type React from 'react';
  import type { SVGProps } from 'react';
  const component: (props: SVGProps<SVGSVGElement>) => React.ReactElement;
  export default component;
}

if use types just from the library, i can't use ?raw query, because ts, based on provided d.ts think this is component,

MB I'm missing sampling, but now i need to write custom types instead of Plug'N'Play.

Should i make PR about fix this stuff?

Reproduction

https://codesandbox.io/s/proud-river-hcuf9o?file=/src/App.tsx

System Info

System:
    OS: Windows 10 10.0.22000
    CPU: (24) x64 AMD Ryzen 9 5900X 12-Core Processor
    Memory: 21.70 GB / 31.92 GB
  Binaries:
    Node: 16.17.0 - C:\Program Files\nodejs\node.EXE
    npm: 8.17.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.22000.120.0), Chromium (105.0.1343.42)
    Internet Explorer: 11.0.22000.120

Used Package Manager

pnpm

Validations

  • [X] Follow our Code of Conduct
  • [X] Read the Contributing Guide.
  • [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • [X] Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • [X] The provided reproduction is a minimal reproducible of the bug.

RainyPixel avatar Sep 19 '22 02:09 RainyPixel

Seems like this is likely limited by https://github.com/microsoft/TypeScript/issues/38638

*?raw could be added but it would not match anything past the ?raw

stramel avatar Oct 13 '22 17:10 stramel