Skip to content
This repository has been archived by the owner on Dec 13, 2018. It is now read-only.

TypeScript: Add recursive array type to CSS prop #383

Merged
merged 2 commits into from
Feb 17, 2018

Conversation

quicksnap
Copy link
Collaborator

What:

Fixes the type definitions for css prop. The css prop actually accepts either an object or an array of nested objects/arrays.

Why:
TypeScript support

How:
Leverage recursive types described in this comment: microsoft/TypeScript#3496 (comment)

Checklist:

  • Documentation N/A
  • Tests
  • Ready to be merged
  • Added myself to contributors table

The build fails due to previous failure. I have PR #382 that fixes this.

@quicksnap
Copy link
Collaborator Author

quicksnap commented Feb 8, 2018

Example of how the current typings would fail:

<Div css={[ { fontSize: 40 }, [ { fontSize: 50 } ] ]} /> Would throw a TS error

@Ailrun
Copy link
Contributor

Ailrun commented Feb 16, 2018

@quicksnap Could you rebase (or merge, or whatever to sync with master) this PR?

@quicksnap
Copy link
Collaborator Author

Done. Hopefully all passes now? =)

@quicksnap
Copy link
Collaborator Author

In order to automate release, should I adjust my commit message or something?

@kentcdodds
Copy link
Contributor

When you click "Squash and merge" you'll see this which allows you to change the commit message of the squashed commit:

screen shot 2018-02-16 at 2 37 53 pm

@codecov-io
Copy link

codecov-io commented Feb 16, 2018

Codecov Report

Merging #383 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #383   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          10     10           
  Lines         182    182           
  Branches       52     52           
=====================================
  Hits          182    182

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a2dcedf...c3b1db9. Read the comment docs.

@@ -1,4 +1,4 @@
import {CSSProperties} from './css-properties'
import {CSSProperties, CSSPropertiesRecursive} from './css-properties'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still use CSSProperties in this file?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope; I've removed and updated

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants