dnd-kit
dnd-kit copied to clipboard
Generated types are broken
Looks like too old typescript version or old react types generates types incompatible with modern react.
Here NamedExoticComponent produces any with noLibCheck
https://unpkg.com/browse/@dnd-kit/[email protected]/dist/components/DndContext/DndContext.d.ts
I use [email protected] and @types/[email protected]
Alright, I see NamedExoticComponent in latest react types.
But it doesn't work because of default import import React from 'react';
Not recommended by react team anymore. Better use import * as React from 'react';
.
Another negative point of default react import is not manglable React.createElement(). Namespace import would be expanded by rollup (tsdx) into import { createElement } from 'react'
and each call could be minified.
Oh, I got it now. esModuleInterop is required. Thought it doesn't affect types. But anyway named exports rock.
Hey @TrySound, thanks for the detailed report 👍 I'm planning to update the development and build tooling of this project in the coming months, will tackle this issue at the same time when I start working on this.
From the sounds of it, this isn't a blocker for you at the moment since there is a workaround.