Hi there,
I haven't used ReactQuill before so I can't speak to whether this was working previously or not but I just pulled it down and in typescript am getting the following error:
TS1192: Module '"projectroot/node_modules/react-quill/types"' has no default export.
I am importing it like so
import ReactQuill from 'react-quill';
I am noticing @clinyong made the change the other day from
export default class Component extends React.Component<ComponentProps> {
focus(): void;
blur(): void;
getEditor(): Quill.Quill;
}
to
declare class ReactQuill extends React.Component<ReactQuill.ComponentProps> {
focus(): void;
blur(): void;
getEditor(): Quill.Quill;
}
export = ReactQuill;
When you do export = ReactQuilll, ts doesn't treat it as default. You can fix this by saying
export default ReactQuill
on line 94 - https://github.com/zenoamaro/react-quill/blame/master/types.d.ts#L94
I can make a pr if you guys want but one of the contributors can probably do it faster than me pulling everything down. Let me know.
Cheers,
Igor
Just as an update, I tried a couple of different approaches and the way the d.ts file is now _will_ work if you import it like so:
import * as ReactQuill from 'react-quill';
which is perfectly reasonable as long as your README is consistent with that, which it's not - https://github.com/zenoamaro/react-quill#import-the-component
Igor
In TS, you should not import ReactQuill as default, you can import in two ways
import * as ReactQuill from 'react-quill';
import ReactQuill = require('react-quill');
You can see the TS doc here.
And also maybe we can update README for TS...
Right - that's what I meant by my second comment.
https://github.com/zenoamaro/react-quill/blob/master/README.md#import-the-component
Added a TS import example
I can import ReactQuill, but I can't import UnprivilegedEditor, so I can' t add types to my event handlers. Only Quill shows up as a non-default export.
@patrick-jones applying this patch should fix your typing issue: https://github.com/zenoamaro/react-quill/pull/433
@alexkrolick can you take a look?
Most helpful comment
I can import
ReactQuill, but I can't importUnprivilegedEditor, so I can' t add types to my event handlers. OnlyQuillshows up as a non-default export.