Skip to content

Commit

Permalink
Use import type statement in readme
Browse files Browse the repository at this point in the history
  • Loading branch information
frenic committed May 16, 2022
1 parent 01e2d9b commit 684b078
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ TypeScript and Flow definitions for CSS, generated by [data from MDN](https://gi
**TypeScript**

```ts
import * as CSS from 'csstype';
import type * as CSS from 'csstype';

const style: CSS.Properties = {
colour: 'white', // Type error on property
Expand Down Expand Up @@ -121,7 +121,7 @@ All interfaces has two optional generic argument to define length and time: `CSS
## Usage

```ts
import * as CSS from 'csstype';
import type * as CSS from 'csstype';
const style: CSS.Properties = {
width: '10px',
Expand All @@ -132,7 +132,7 @@ const style: CSS.Properties = {
In some cases, like for CSS-in-JS libraries, an array of values is a way to provide fallback values in CSS. Using `CSS.PropertiesFallback` instead of `CSS.Properties` will add the possibility to use any property value as an array of values.

```ts
import * as CSS from 'csstype';
import type * as CSS from 'csstype';
const style: CSS.PropertiesFallback = {
display: ['-webkit-flex', 'flex'],
Expand All @@ -143,7 +143,7 @@ const style: CSS.PropertiesFallback = {
There's even string literals for pseudo selectors and elements.

```ts
import * as CSS from 'csstype';
import type * as CSS from 'csstype';
const pseudos: { [P in CSS.SimplePseudos]?: CSS.Properties } = {
':hover': {
Expand All @@ -155,7 +155,7 @@ const pseudos: { [P in CSS.SimplePseudos]?: CSS.Properties } = {
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`.

```ts
import * as CSS from 'csstype';
import type * as CSS from 'csstype';
interface Style extends CSS.Properties, CSS.PropertiesHyphen {}
Expand All @@ -170,7 +170,7 @@ const style: Style = {
Adding type checked CSS properties to a `HTMLElement`.

```ts
import * as CSS from 'csstype';
import type * as CSS from 'csstype';
const style: CSS.Properties = {
color: 'red',
Expand Down Expand Up @@ -200,7 +200,7 @@ _If you're using CSS Custom Properties you can step directly to step 3._

```ts
// My css.d.ts file
import * as CSS from 'csstype';
import type * as CSS from 'csstype';
declare module 'csstype' {
interface Properties {
Expand Down

0 comments on commit 684b078

Please sign in to comment.