svgr icon indicating copy to clipboard operation
svgr copied to clipboard

Add type definitions for TypeScript projects

Open Iulia-Soimaru opened this issue 6 years ago • 4 comments

Are there any plans to add type definitions so TypeScript projects can use this library?

Right now I can only manually figure out types for everything I need:

import templateBuilder, { TemplateBuilderOptions } from 'babel__template';
import { ParserPlugin } from '@babel/parser';

type SVGRProps = {
    componentName: ...;
    props: ...;
    imports: ...;
    interfaces: ...;
    jsx: ...;
};

const customTemplate = (
    { template }: { template: typeof templateBuilder },
    _opts: TemplateBuilderOptions,
    { componentName, jsx }: SVGRProps
) => { 
    const plugins: ParserPlugin[] = ['typescript'];
    const typeScriptTpl = template.smart({ plugins });
    // ...my custom template
}

Iulia-Soimaru avatar May 12 '20 18:05 Iulia-Soimaru

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jul 11 '20 19:07 stale[bot]

I don't think this has a fix (or answer) yet? Should probably be kept open

madeleineostoja avatar Jul 12 '20 08:07 madeleineostoja

Hello, yes it is planned to add TypeScript definitions to this project. Since I am not a power TypeScript user, help is welcome here!

gregberge avatar Jul 27 '20 15:07 gregberge

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Sep 25 '20 16:09 stale[bot]