- Регистрация
- 1 Мар 2015
- Сообщения
- 1,481
- Баллы
- 155
In this article, you will learn how can be used to type check your .
I found csstype type dependency in .
"dependencies": {
"csstype": "^3.1.3",
"inferno-vnode-flags": "9.0.3",
"opencollective-postinstall": "^2.0.3"
}
I searched for this package on npm and found this .
CSSType
TypeScript and Flow definitions for CSS, generated by . It provides autocompletion and type checking for CSS properties and values.
TypeScript example
import type * as CSS from 'csstype';
const style: CSS.Properties = {
colour: 'white', // Type error on property
textAlign: 'middle', // Type error on value
};
mdn/data
mdn/data is a repository that contains general data for Web technologies.
Below is a note picked from README.md
I searched for csstype in inferno codebase and found the below search results.
CSSType is found only in 3 places.
I am interested in learning more how csstype is used in .
Below is imported in core/types.ts at L9:
import type { PropertiesHyphen } from 'csstype';
and this PropertiesHyphen is used as a type in an interface called HTMLAttributes as shown below:
interface HTMLAttributes<T> extends AriaAttributes, DOMAttributes<T> {
...
style?: PropertiesHyphen | string | null | undefined | CssVariables;
}
I found the below information from the CSSType about the PropertiesHyphen:
Hyphen cased (kebab cased) properties are provided in CSS.PropertiesHyphen and CSS.PropertiesHyphenFallback. It's not not added by default in CSS.Properties. To allow both of them, you can simply extend with CSS.PropertiesHyphen or/and CSS.PropertiesHyphenFallback.
import type * as CSS from 'csstype';
interface Style extends CSS.Properties, CSS.PropertiesHyphen {}
const style: Style = {
'flex-grow': 1,
'flex-shrink': 0,
'font-weight': 'normal',
backgroundColor: 'white',
};
About me:
Hey, my name is . I study large open-source projects and create content about their codebase architecture and best practices, sharing it through articles, videos.
Configure features such as Changesets, Supabase authentication in your Next.js project using .
Email — ramu@thinkthroo.com
My Github —
My website —
My YouTube channel —
Learning platform —
Codebase Architecture —
Best practices —
Production-grade projects —
References
I found csstype type dependency in .
"dependencies": {
"csstype": "^3.1.3",
"inferno-vnode-flags": "9.0.3",
"opencollective-postinstall": "^2.0.3"
}
I searched for this package on npm and found this .
CSSType
TypeScript and Flow definitions for CSS, generated by . It provides autocompletion and type checking for CSS properties and values.
TypeScript example
import type * as CSS from 'csstype';
const style: CSS.Properties = {
colour: 'white', // Type error on property
textAlign: 'middle', // Type error on value
};
mdn/data
mdn/data is a repository that contains general data for Web technologies.
Below is a note picked from README.md
CSSType usage in Inferno.js codebaseNote: We are in the process of deprecating the mdn/data package in favor of . If you depend on this project, let us know in our community . Thank you.
I searched for csstype in inferno codebase and found the below search results.
CSSType is found only in 3 places.
tests/styles.spec.tsx
I am interested in learning more how csstype is used in .
Below is imported in core/types.ts at L9:
import type { PropertiesHyphen } from 'csstype';
and this PropertiesHyphen is used as a type in an interface called HTMLAttributes as shown below:
interface HTMLAttributes<T> extends AriaAttributes, DOMAttributes<T> {
...
style?: PropertiesHyphen | string | null | undefined | CssVariables;
}
I found the below information from the CSSType about the PropertiesHyphen:
Hyphen cased (kebab cased) properties are provided in CSS.PropertiesHyphen and CSS.PropertiesHyphenFallback. It's not not added by default in CSS.Properties. To allow both of them, you can simply extend with CSS.PropertiesHyphen or/and CSS.PropertiesHyphenFallback.
import type * as CSS from 'csstype';
interface Style extends CSS.Properties, CSS.PropertiesHyphen {}
const style: Style = {
'flex-grow': 1,
'flex-shrink': 0,
'font-weight': 'normal',
backgroundColor: 'white',
};
About me:
Hey, my name is . I study large open-source projects and create content about their codebase architecture and best practices, sharing it through articles, videos.
Configure features such as Changesets, Supabase authentication in your Next.js project using .
Email — ramu@thinkthroo.com
My Github —
My website —
My YouTube channel —
Learning platform —
Codebase Architecture —
Best practices —
Production-grade projects —
References