mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
b0a9053e67
Summary:
Previously, when you tried to create some styles using `StyleSheet.create`, you can create styles with invalid styles:
```ts
const styles = StyleSheet.create({
container: {
marginLeft: 1,
magrinRight: 1, // This is a typo, but would not cause typecheck errors
},
});
```
The root cause is that Typescript uses a looser [Excess Property Checks](https://www.typescriptlang.org/docs/handbook/2/objects.html#excess-property-checks) if we're using template types rather than using the actual specific types in the function signature.
- https://github.com/DefinitelyTyped/DefinitelyTyped/discussions/62481
## Changelog:
[INTERNAL] [FIXED] - Make StyleSheet.create better check property keys for typos
Pull Request resolved: https://github.com/facebook/react-native/pull/39225
Test Plan: Added a test in __typeTests__, which should get run by CI.
Reviewed By: rshest
Differential Revision: D48859679
Pulled By: NickGerleman
fbshipit-source-id: 43aa69cf85cd69353d053b782dba73ab2027eb64