vanilla-extract
vanilla-extract.style
vanilla-extract — Zero-runtime Stylesheets-in-TypeScript.
Use TypeScript as your preprocessor. Write type‑safe, locally scoped classes, variables and themes, then generate static CSS files at build time. $npm install @vanilla-extract/css · Get started · GitHub · styles.css.ts ·
GitHub
github.com › thoughtbot › react-native-typescript-styles › blob › main › STYLE_GUIDE.md
react-native-typescript-styles/STYLE_GUIDE.md at main · thoughtbot/react-native-typescript-styles
// index.ts import * as Buttons from "./buttons" import * as Colors from "./colors" import * as Sizing from "./sizing" import * as Typography from "./typography" export { Buttons, Colors, Sizing, Typography } // component.ts import { Sizing, Colors } from "../styles" ... const style = StyleSheet.create({ container: { padding: Sizing.layout.x10 backgroundColor: Colors.neutral.gray6 } })
Author thoughtbot
Videos
12:24
Styling React Components - React & TypeScript - Ep 10 - YouTube
07:16
Text, View and Stylesheet in React Native Typescript #2 | Dr Vipin ...
40:10
React Typescript #2 Styling with Styled Components - YouTube
10:12
React & Typescript - #8 Styling - YouTube
12:04
Utilizando Styled Components (CSS-in-JS) no ReactJS e React Native ...
GitHub
github.com › typestyle › typestyle
GitHub - typestyle/typestyle: Making CSS Typesafe 🌹
Use it like you would use CSS modules or CSS in general with webpack etc, but this time you get to use TypeScript / JavaScript!
Starred by 3.1K users
Forked by 86 users
Languages TypeScript 96.9% | JavaScript 1.7% | HTML 1.4% | TypeScript 96.9% | JavaScript 1.7% | HTML 1.4%
GitHub
github.com › thoughtbot › react-native-typescript-styles
GitHub - thoughtbot/react-native-typescript-styles: Kick-start your new React Native project with simple, organized styles.
September 24, 2019 - const style = StyleSheet.create({ header: { paddingBottom: Sizing.x20, borderBottomWidth: Outlines.borderWidth.thin, borderColor: Colors.neutral.gray6, }, headerText: { ...Typography.bold.x50, }, button: { ...Buttons.bar.primary, }, buttonText: { ...Buttons.barText.primary, }, });
Starred by 19 users
Forked by 3 users
Languages TypeScript 95.3% | JavaScript 4.7% | TypeScript 95.3% | JavaScript 4.7%
Google
google.github.io › styleguide › tsguide.html
Google TypeScript Style Guide
This guide is based on the internal Google TypeScript style guide, but it has been slightly adjusted to remove Google-internal sections. Google's internal environment has different constraints on TypeScript than you might find outside of Google.
Typhonjs-typedoc
typhonjs-typedoc.github.io › ts-lib-docs › 2023 › dom › interfaces › StyleSheet.html
StyleSheet | Typescript Library Declarations (DOM)
Typescript Library Declarations (DOM) A single style sheet. CSS style sheets will further implement the more specialized CSSStyleSheet interface. MDN Reference · StyleSheet · disabled href media owner · Node parent · Style · Sheet title type · disabled: boolean ·
npm
npmjs.com › package › typescript-style-sheet
typescript-style-sheet - npm
November 13, 2018 - npm i typescript-style-sheet · github.com/sammi/typescript-style-sheet · github.com/sammi/typescript-style-sheet#readme · 2 · 0.0.4 · MIT · 2.06 kB · 2 · 6 years ago · Try on RunKit ·
» npm install typescript-style-sheet
Published Nov 13, 2018
Version 0.0.4
Author Sammi Song
GitHub
github.com › microsoft › TypeScript-React-Native-Starter › issues › 25
no code hint to use StyleSheet.create · Issue #25 · microsoft/TypeScript-React-Native-Starter
January 30, 2018 - microsoft / TypeScript-React-Native-Starter Public archive ... interface Style { main: ViewStyle; closeButton: ViewStyle; closeText: TextStyle; } const styles = StyleSheet.create<Style>({ main: { flex: 1, ..., }, closeButton: { textAlign: 'center', zIndex: 3, ..., }, closeText: { fontSize: 48, ..., }, }); Sign up for free to subscribe to this conversation on GitHub...
GitHub
github.com › Quramy › typed-css-modules
GitHub - Quramy/typed-css-modules: Creates .d.ts files from CSS Modules .css files · GitHub
Starred by 1.1K users
Forked by 68 users
Languages TypeScript 80.4% | JavaScript 16.8% | CSS 2.3%
Top answer 1 of 3
2
StylesSheet doesn't support using fuctions but you can use an Object or a Function instead and type the return value with one of these types ViewStyle | TextStyle | ImageStyle
E.g
const styles = {
square: (size: number): ViewStyle => ({
width: size,
height: size,
})
};
2 of 3
0
Even if this works fine in JS, as Stylesheet.create simply returns the object passed as a parameter, it throws a typing error in TS. The method is typed as followed:
export namespace StyleSheet {
type NamedStyles<T> = {[P in keyof T]: ViewStyle | TextStyle | ImageStyle};
/**
* Creates a StyleSheet style reference from the given object.
*/
export function create<T extends NamedStyles<T> | NamedStyles<any>>(
styles: T | NamedStyles<T>,
): T;
}
Here you can see that it takes an object as a parameter where each value must be of type ViewStyle | TextStyle | ImageStyle.
As mentioned by @DanielGabor you can still create a style object without using Stylesheet.create where keys return functions that themselves return ViewStyle | TextStyle | ImageStyle
Detox
wix.github.io › stylable
Welcome to Stylable - CSS for Components
We want to give CSS a type system — to do for CSS what TypeScript does for JavaScript.
GitHub
github.com › emotion-js › emotion › issues › 1267
Typescript Type support for style objects · Issue #1267 · emotion-js/emotion
March 12, 2019 - I'm working with React Typescript and Emotion. So far I have used template strings, but I'd like to gradually move to style objects. I'd like to be able to declare a style object, get type support from the editor, and then pass it to a css function, or a styled component.
Author carpben
GitHub
github.com › frenic › csstype
GitHub - frenic/csstype: Strict TypeScript and Flow types for style based on MDN data · GitHub
Starred by 1.8K users
Forked by 75 users
Languages TypeScript 98.4% | JavaScript 1.6%
Typestyle
typestyle.github.io
TypeStyle
We cannot provide a description for this page right now
GitHub
github.com › styleguidist › react-docgen-typescript
GitHub - styleguidist/react-docgen-typescript: A simple parser for react properties defined in typescript instead of propTypes. · GitHub
Will generate the following stylesheet: The typescript is pretty complex and there are many different ways how to define components and their props so it's realy hard to support all these use cases. That means only one thing, contributions are highly welcome.
Starred by 1.3K users
Forked by 257 users
Languages TypeScript
GitHub
github.com › DefinitelyTyped › DefinitelyTyped › discussions › 62481
[@types/react-native] StyleSheet.create won't raise error for unexisting properties · DefinitelyTyped/DefinitelyTyped · Discussion #62481
Basically, TypeScript won't raise any Error for the object passed into StyleSheet.create() with any kind of unexisting properties. But I have totally no idea why. I didn't find anything like [K: st...
Author DefinitelyTyped