12.2.1 • Published 1 year ago

fela-plugin-typescript v12.2.1

Weekly downloads
373
License
MIT
Repository
github
Last release
1 year ago

fela-plugin-typescript

This plugins allows you to write type-safe style rules and provides some autocomplete for you:

Autocomplete

Installation

yarn add fela-plugin-typescript

You may alternatively use npm i --save fela-plugin-typescript.

Usage

Make sure to read the documentation on how to use plugins.

import { createRenderer } from 'fela'
import typescript from 'fela-plugin-typescript'

const renderer = createRenderer({
  plugins: [typescript()],
})

Example

Input

{
  color: 'red',
  width: 5,
  nested: {
    ':last-child': {
      padding: 10,
      height: 5,
    },
  },
}

Output

{
  color: 'red',
  width: 5,
  ':last-child': {
    padding: 10,
    height: 5,
  },
}

FAQ

Why use additional prop "nested"?

In Typescript you can't declare a simple property and indexed property with different types of values in single type. For example it will not work:

type IStyle = {
  padding?: number // <-- Error: Property 'padding' of type 'number'
  // is not assignable to string index type 'IStyle'.
  [selector: string]: IStyle
}

So the "nested" property is a tricky way to provide type-safety of Fela rules.

License

Fela is licensed under the MIT License. Documentation is licensed under Creative Commons License. Created with ♥ by @robinweser and all the great contributors.

12.2.1

1 year ago

12.2.0

2 years ago

12.1.2

2 years ago

12.1.0

2 years ago

12.1.1

2 years ago

12.0.0

2 years ago

12.0.1

2 years ago

12.0.2

2 years ago

12.0.0-y.0

2 years ago

12.0.0-rc.3.0

2 years ago

12.0.0-rc.1

2 years ago

12.0.0-rc.2

2 years ago

12.0.0-rc.0

2 years ago

11.7.0

3 years ago

11.6.1

3 years ago

11.6.0

3 years ago

11.5.2

3 years ago

11.5.1

3 years ago

11.5.0

3 years ago

11.5.0-rc.0

3 years ago

11.4.0

4 years ago

11.3.3

4 years ago

11.3.2

4 years ago

11.3.1

4 years ago

11.3.0

4 years ago

11.2.0

4 years ago

11.1.1

4 years ago

11.1.2

4 years ago

11.1.0

4 years ago

11.0.2

4 years ago

11.0.1

4 years ago

11.0.0

4 years ago

10.8.2

5 years ago

10.8.1

5 years ago

10.8.0

5 years ago

10.7.0

5 years ago

10.6.1

5 years ago

10.6.0

5 years ago

10.5.0

5 years ago

10.4.1

5 years ago

10.4.0

5 years ago

10.3.0

5 years ago