malte-wessel / react-textfit

React component to fit headlines and paragraphs into elements
http://malte-wessel.github.io/react-textfit/
MIT License
469 stars 143 forks source link

Typescript #75

Open micha-lmxt opened 3 years ago

micha-lmxt commented 3 years ago

Add typescript declaration file

iofjuupasli commented 3 years ago

Please add children type, and make props optional

micha-lmxt commented 3 years ago

good points, it's updated

ZekNikZ commented 3 years ago
import React from 'react';

interface Props {
    text?: string;
    min?: number;
    max?: number;
    mode?: 'single' | 'multi';
    forceSingleModeWidth?: boolean;
    throttle?: number;
    onReady?: (number) => void;
}

declare module 'react-textfit' {
    export declare class Textfit extends React.Component<Props> {}
    export default Textfit;
}

Would not this be better? Accounts for children and more explicitly describes the exports

peterblazejewicz commented 2 years ago

to be fixed in: DefinitelyTyped/DefinitelyTyped#58461