diff --git a/types/react-sketchapp/index.d.ts b/types/react-sketchapp/index.d.ts index 5f950af455..f340e19232 100644 --- a/types/react-sketchapp/index.d.ts +++ b/types/react-sketchapp/index.d.ts @@ -275,3 +275,9 @@ export function makeSymbol

( * Injects the symbols into Sketch's symbol page. **Call this before rendering.** */ export function injectSymbols(context: SketchContext): void; + +export const Platform: { + OS: 'sketch', + Version: 1, + select: (obj: any) => any +}; diff --git a/types/react-sketchapp/react-sketchapp-tests.tsx b/types/react-sketchapp/react-sketchapp-tests.tsx index 8ebb12514e..f72c80fd78 100644 --- a/types/react-sketchapp/react-sketchapp-tests.tsx +++ b/types/react-sketchapp/react-sketchapp-tests.tsx @@ -1,24 +1,26 @@ -import { Artboard, View, Text, StyleSheet, TextStyles, render, renderToJSON } from 'react-sketchapp'; +import { + Artboard, View, Text, StyleSheet, TextStyles, render, renderToJSON, Platform +} from 'react-sketchapp'; // the styles object should be a mapped typed mapping the keys of the object literal to numbers const styles = StyleSheet.create({ - red: { - backgroundColor: '#FF00000' - }, - flexRow: { - flexDirection: 'row' - } + red: { + backgroundColor: '#FF00000' + }, + flexRow: { + flexDirection: 'row' + } }); // style references are numbers const styleReference = styles.red; const Document = () => - - text must be a string - - - + + text must be a string + + + ; render(); @@ -31,11 +33,14 @@ Artboard.prototype.componentDidMount; // TODO: currently this interface returns any but it looks like this method produces a side-affect // and the return type isn't used anyway TextStyles.create(context as any, { - normal: { - fontSize: 16, - }, - heading: { - fontSize: 16 * 1.618, - fontWeight: 'bold', - } + normal: { + fontSize: 16, + }, + heading: { + fontSize: 16 * 1.618, + fontWeight: 'bold', + } }); + +const shouldBeSketch = Platform.OS; +const shouldBe1 = Platform.Version;