Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6295

React Native Typescript, Type 'string' is not assignable to type '"200" | "600" etc

$
0
0

I am passing a theme into my style.ts:

badgeText: {  fontWeight: theme.fonts.FONT_WEIGHT_HEAVY,},

Constants:

export default {  FONT_SIZE_EXTRA_SMALL: 8,  FONT_SIZE_VERY_SMALL: 11,  FONT_SIZE_SMALL: 14,  FONT_SIZE_MEDIUM: 16,  FONT_SIZE_EXTRA_MEDIUM: 18,  FONT_SIZE_LARGE: 20,  FONT_SIZE_X_LARGE: 22,  FONT_SIZE_XX_LARGE: 24,  FONT_SIZE_XXX_LARGE: 28,  FONT_WEIGHT_LIGHT: '200',  FONT_WEIGHT_MEDIUM: '600',  FONT_WEIGHT_HEAVY: '800',  LIGHT: 'DINRoundOT-Light',  MEDIUM: 'DINRoundOT-Medium',  BOLD: 'DINRoundOT-Bold',  REGULAR: 'DINRoundOT',};

I get the error below, any ideas?

(property) TextStyle.fontWeight?: "200" | "600" | "800" | "normal" | "bold" | "100" | "300" | "400" | "500" | "700" | "900" | undefinedSpecifies font weight. The values 'normal' and 'bold' are supported for most fonts. Not all fonts have a variant for each of the numeric values, in that case the closest one is chosen.Type 'string' is not assignable to type '"200" | "600" | "800" | "normal" | "bold" | "100" | "300" | "400" | "500" | "700" | "900" | undefined'.ts

Viewing all articles
Browse latest Browse all 6295

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>