-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
Current behaviour
configureFonts's typings does not calculate isV3 correctly, meaning that it will fail with any Material Design 2 configuration
Expected behaviour
configureFonts should allow me to insert a Material Design 2 font configuration if the isV3 flag is set correctly
How to reproduce?
- Copy the code from the documentation
- Paste it into a brand new file anywhere with the codebase, as long as the dependencies can be found
- Remove the third line;
./src/Appis not a guaranteed file and very much example exclusive - Remove the export default lines at the bottom; we're trying to find type errors.
Congrats; we now have documentation-sourced code that crashes on us.
Preview
Underlined under config:
No overload matches this call.
The last overload gave the following error.
Type '{ web: { regular: { fontFamily: string; fontWeight: string; }; medium: { fontFamily: string; fontWeight: string; }; light: { fontFamily: string; fontWeight: string; }; thin: { fontFamily: string; fontWeight: string; }; }; ios: { ...; }; android: { ...; }; }' is not assignable to type 'Record<string, MD3Type>'.
Property 'web' is incompatible with index signature.
Type '{ regular: { fontFamily: string; fontWeight: string; }; medium: { fontFamily: string; fontWeight: string; }; light: { fontFamily: string; fontWeight: string; }; thin: { fontFamily: string; fontWeight: string; }; }' is missing the following properties from type 'MD3Type': fontFamily, letterSpacing, fontWeight, lineHeight, fontSize
Type 'false' is not assignable to type 'true'.ts(2769)
fonts.d.ts(78, 5): The expected type comes from property 'config' which is declared here on type '{ config: Record<string, MD3Type>; isV3?: true | undefined; }'
fonts.d.ts(77, 25): The last overload is declared here.
Underlined under isV3:
No overload matches this call.
The last overload gave the following error.
Type '{ web: { regular: { fontFamily: string; fontWeight: string; }; medium: { fontFamily: string; fontWeight: string; }; light: { fontFamily: string; fontWeight: string; }; thin: { fontFamily: string; fontWeight: string; }; }; ios: { ...; }; android: { ...; }; }' is not assignable to type 'Record<string, MD3Type>'.
Property 'web' is incompatible with index signature.
Type '{ regular: { fontFamily: string; fontWeight: string; }; medium: { fontFamily: string; fontWeight: string; }; light: { fontFamily: string; fontWeight: string; }; thin: { fontFamily: string; fontWeight: string; }; }' is missing the following properties from type 'MD3Type': fontFamily, letterSpacing, fontWeight, lineHeight, fontSize
Type 'false' is not assignable to type 'true'.ts(2769)
fonts.d.ts(79, 5): The expected type comes from property 'isV3' which is declared here on type '{ config: Record<string, MD3Type>; isV3?: true | undefined; }'
fonts.d.ts(77, 25): The last overload is declared here.
What have you tried so far?
Use official code from the people who provided the service; that proved the same thing.
Your Environment
The standard-table is non-applicable for this instance. Since this is a type error, I am using VSCodium 1.76.2's Intellisense under TypeScript 5.0.2
