fluentui-system-icons icon indicating copy to clipboard operation
fluentui-system-icons copied to clipboard

Can @fluentui/react-icons produce a custom .d.ts file which is more performant?

Open markjm opened this issue 4 years ago • 0 comments

Hi all - in profiling our typescript compile, we can see that processing & adding the types for this package takes about 5 seconds

image

This is because index.d.ts looks like (below), which forces typescript to crawl the file system to find all these icons and add them to the project. image

Changing the .d.ts file to look like (below) is functionally equivalent, but much more performant:

/// <reference types="react" />
import { IFluentIconsProps } from './utils/IFluentIconsProps.types';
type IconFunction = (iconProps: IFluentIconsProps) => JSX.Element;

export const AccessTime24Filled: IconFunction;
export const AccessTime24Regular: IconFunction;
export const Accessibility16Filled: IconFunction;
...
export const ZoomOut24Regular: IconFunction;

export { IFluentIconsProps } from './utils/IFluentIconsProps.types';
export { default as wrapIcon } from './utils/wrapIcon';

Thanks!

markjm avatar Jul 21 '21 18:07 markjm