Comments (3)
That's a good suggestion!
I'm also new to web-component. I'll try to refine this part of the type definition.
from dockbar.
@LoTwT
It seems that if I want to and types for react in this package, I have to add @types/react
for devDeps. I'm not pretty sure is that appropriate. And for other frameworks, we may need some other types. In my opinion, relying on external framework like React in a web-component project may contradict the original design intention.
For temporary, maybe you can declare types in your own repo. Here is an example that may helps:
type CustomElement<T> = Partial<
T & { children: unknown } & import("react").DOMAttributes<T> &
import("react").HTMLAttributes<T> &
import("react").Attributes
>;
declare namespace JSX {
interface IntrinsicElements {
["dock-wrapper"]: CustomElement<import("dockbar").DockWrapper>;
["dock-item"]: CustomElement<import("dockbar").DockItem>;
}
}
I will continue exploring viable solution and improving them in the README.
from dockbar.
@LoTwT It seems that if I want to and types for react in this package, I have to add
@types/react
for devDeps. I'm not pretty sure is that appropriate. And for other frameworks, we may need some other types. In my opinion, relying on external framework like React in a web-component project may contradict(反驳) the original design intention(意图).For temporary(临时), maybe you can declare types in your own repo. Here is a example that may helps:
type CustomElement<T> = Partial< T & { children: unknown } & import("react").DOMAttributes<T> & import("react").HTMLAttributes<T> & import("react").Attributes >; declare namespace JSX { interface IntrinsicElements { ["dock-wrapper"]: CustomElement<import("dockbar").DockWrapper>; ["dock-item"]: CustomElement<import("dockbar").DockItem>; } }I will continue exploring viable(可行) solution and improving them in the README.
You are right. Extra dependencies are verbose.
Displaying the type definitions prominently in the README is enough.
from dockbar.
Related Issues (7)
- Mouse move over gap will trigger `blur` event HOT 1
- Formatting HTML Breaks This Package HOT 1
- Mouse move over gap will still trigger blur event when direction is vertical
- the dockbar doesn't display in the playground HOT 3
- optimize publish related settings
- feat proposal: a divider between the dock-items HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dockbar.