Skip to content

Commit 4309aaa

Browse files
authoredNov 12, 2021
Patch inexact type causing compatibility issues and update flowconfig (#905)
1 parent df4be3e commit 4309aaa

File tree

4 files changed

+17
-1
lines changed

4 files changed

+17
-1
lines changed
 

‎.changeset/curvy-wasps-shake.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@compiled/react': patch
3+
---
4+
5+
Patch inexact flow type on styled

‎.flowconfig

+8
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,19 @@ packages/.*/*.js.flow
1010
.*/node_modules/.*
1111

1212
[lints]
13+
deprecated-utility=warn
14+
unnecessary-optional-chain=warn
15+
implicit-inexact-object=error
16+
untyped-type-import=error
1317

1418
[options]
19+
exact_by_default=true
1520

1621
[strict]
22+
deprecated-type
23+
deprecated-utility
1724
nonstrict-import
25+
sketchy-null
1826
unclear-type
1927
unsafe-getters-setters
2028
untyped-import

‎packages/react/src/styled/index.js.flow

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export interface StyledFunctionFromTag<TTag: $Keys<$JSXIntrinsics>> {
3333
...interpolations: Interpolations<TProps>
3434
): React$ComponentType<{
3535
...TProps,
36-
...$ElementType<$JSXIntrinsics, TTag>,
36+
...$Exact<$ElementType<$JSXIntrinsics, TTag>>,
3737
...StyledProps,
3838
}>;
3939
}

‎scripts/flow-types.sh

+3
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ generate() {
3131
# Rename JSX.IntrinsicElements to existing flow type
3232
sed -i.bak -E 's/JSX.IntrinsicElements/$JSXIntrinsics/g' "$file" && rm "$file.bak"
3333

34+
# Rename $ElementType<$JSXIntrinsics, TTag> to exact flow typs
35+
sed -i.bak -E 's/\$ElementType<\$JSXIntrinsics, TTag>/$Exact<$ElementType<$JSXIntrinsics, TTag>>/g' "$file" && rm "$file.bak"
36+
3437
# Rename jest.CustomMatcherResult type to existing flow type
3538
sed -i.bak -E 's/jest.CustomMatcherResult/JestMatcherResult/g' "$file" && rm "$file.bak"
3639

0 commit comments

Comments
 (0)
Please sign in to comment.