Skip to content

Commit

Permalink
Flow exact properties testing
Browse files Browse the repository at this point in the history
  • Loading branch information
frenic committed Mar 16, 2018
1 parent e039910 commit d2ebebd
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions typecheck.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

import * as CSS from './';

const css: CSS.Properties<*> = {
// Fallback due to https://github.com/frenic/csstype/issues/17
type Exact<T> = T & $Shape<T>;

const css: Exact<CSS.Properties<*>> = {
flexGrow: 1,
flexShrink: 1,
flexBasis: '1px',
Expand All @@ -14,7 +17,7 @@ const css: CSS.Properties<*> = {
height: '1px',
};

const cssWithFallbackValues: CSS.PropertiesFallback<*> = {
const cssWithFallbackValues: Exact<CSS.PropertiesFallback<*>> = {
flexGrow: [1],
flexShrink: [1],
flexBasis: ['1px'],
Expand All @@ -26,7 +29,7 @@ const cssWithFallbackValues: CSS.PropertiesFallback<*> = {
height: ['1px'],
};

const cssWithHyphenProperties: CSS.PropertiesHyphen<*> = {
const cssWithHyphenProperties: Exact<CSS.PropertiesHyphen<*>> = {
'flex-grow': 1,
'flex-shrink': 0,
'flex-basis': '1px',
Expand All @@ -38,11 +41,11 @@ const cssWithHyphenProperties: CSS.PropertiesHyphen<*> = {
height: '1px',
};

const cssWithBothCamelAndHyphenProperties: CSS.Properties<*> & CSS.PropertiesHyphen<*> = {
const cssWithBothCamelAndHyphenProperties: $Exact<CSS.Properties<*>> & $Exact<CSS.PropertiesHyphen<*>> = {
animation: '',
};

const atRuleFontFace: CSS.FontFace = {
const atRuleFontFace: $Exact<CSS.FontFace> = {
fontFamily: '',
fontWeight: 'normal',
};

0 comments on commit d2ebebd

Please sign in to comment.