From 4ce44be36a591c2834f6ab08f213dd70bbcc4994 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20=C5=81opaci=C5=84ski?= Date: Tue, 21 Jan 2025 13:21:53 +0100 Subject: [PATCH] Fix typecheck issues --- apps/common-app/tsconfig.json | 1 - apps/fabric-example/images.d.ts | 13 +++++++++++++ apps/fabric-example/tsconfig.json | 6 ++++++ apps/macos-example/images.d.ts | 13 +++++++++++++ apps/macos-example/tsconfig.json | 17 ++++++++--------- apps/paper-example/images.d.ts | 13 +++++++++++++ apps/paper-example/tsconfig.json | 8 +++++++- apps/web-example/images.d.ts | 13 +++++++++++++ apps/web-example/tsconfig.json | 5 +++-- .../css/component/createAnimatedComponent.tsx | 4 ++-- 10 files changed, 78 insertions(+), 15 deletions(-) create mode 100644 apps/fabric-example/images.d.ts create mode 100644 apps/macos-example/images.d.ts create mode 100644 apps/paper-example/images.d.ts create mode 100644 apps/web-example/images.d.ts diff --git a/apps/common-app/tsconfig.json b/apps/common-app/tsconfig.json index 6c572acd068f..97e8e2cbd000 100644 --- a/apps/common-app/tsconfig.json +++ b/apps/common-app/tsconfig.json @@ -1,7 +1,6 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "plugins": [{ "name": "./resolver.js" }], "baseUrl": ".", "paths": { "@/*": ["src/*"] diff --git a/apps/fabric-example/images.d.ts b/apps/fabric-example/images.d.ts new file mode 100644 index 000000000000..5f1bcde0e96d --- /dev/null +++ b/apps/fabric-example/images.d.ts @@ -0,0 +1,13 @@ +declare module '*.jpg' { + import type { ImageSourcePropType } from 'react-native'; + + const value: ImageSourcePropType; + export default value; +} + +declare module '*.png' { + import type { ImageSourcePropType } from 'react-native'; + + const value: ImageSourcePropType; + export default value; +} diff --git a/apps/fabric-example/tsconfig.json b/apps/fabric-example/tsconfig.json index 41fbcff27c16..1dc2571aaeb9 100644 --- a/apps/fabric-example/tsconfig.json +++ b/apps/fabric-example/tsconfig.json @@ -1,4 +1,10 @@ { "extends": "../../tsconfig.json", + "compilerOptions": { + "baseUrl": ".", + "paths": { + "@/*": ["../common-app/src/*"] + } + }, "exclude": ["node_modules", "metro.config.js"] } diff --git a/apps/macos-example/images.d.ts b/apps/macos-example/images.d.ts new file mode 100644 index 000000000000..5f1bcde0e96d --- /dev/null +++ b/apps/macos-example/images.d.ts @@ -0,0 +1,13 @@ +declare module '*.jpg' { + import type { ImageSourcePropType } from 'react-native'; + + const value: ImageSourcePropType; + export default value; +} + +declare module '*.png' { + import type { ImageSourcePropType } from 'react-native'; + + const value: ImageSourcePropType; + export default value; +} diff --git a/apps/macos-example/tsconfig.json b/apps/macos-example/tsconfig.json index 508b2c0c3eea..d44a1f66875c 100644 --- a/apps/macos-example/tsconfig.json +++ b/apps/macos-example/tsconfig.json @@ -1,11 +1,10 @@ { - "extends": "../../tsconfig.json" - // "compilerOptions": { - // "baseUrl": ".", - // "paths": { - // "react-native-reanimated": ["../"], - // "react": ["./node_modules/@types/react"] - // } - // }, - // "exclude": [] + "extends": "../../tsconfig.json", + "compilerOptions": { + "baseUrl": ".", + "paths": { + "@/*": ["../common-app/src/*"] + // "react": ["./node_modules/@types/react"] + } + } } diff --git a/apps/paper-example/images.d.ts b/apps/paper-example/images.d.ts new file mode 100644 index 000000000000..5f1bcde0e96d --- /dev/null +++ b/apps/paper-example/images.d.ts @@ -0,0 +1,13 @@ +declare module '*.jpg' { + import type { ImageSourcePropType } from 'react-native'; + + const value: ImageSourcePropType; + export default value; +} + +declare module '*.png' { + import type { ImageSourcePropType } from 'react-native'; + + const value: ImageSourcePropType; + export default value; +} diff --git a/apps/paper-example/tsconfig.json b/apps/paper-example/tsconfig.json index 4082f16a5d91..f8f4a4917ead 100644 --- a/apps/paper-example/tsconfig.json +++ b/apps/paper-example/tsconfig.json @@ -1,3 +1,9 @@ { - "extends": "../../tsconfig.json" + "extends": "../../tsconfig.json", + "compilerOptions": { + "baseUrl": ".", + "paths": { + "@/*": ["../common-app/src/*"] + } + } } diff --git a/apps/web-example/images.d.ts b/apps/web-example/images.d.ts new file mode 100644 index 000000000000..5f1bcde0e96d --- /dev/null +++ b/apps/web-example/images.d.ts @@ -0,0 +1,13 @@ +declare module '*.jpg' { + import type { ImageSourcePropType } from 'react-native'; + + const value: ImageSourcePropType; + export default value; +} + +declare module '*.png' { + import type { ImageSourcePropType } from 'react-native'; + + const value: ImageSourcePropType; + export default value; +} diff --git a/apps/web-example/tsconfig.json b/apps/web-example/tsconfig.json index ebc7fcf8d016..a84af1214a70 100644 --- a/apps/web-example/tsconfig.json +++ b/apps/web-example/tsconfig.json @@ -2,9 +2,10 @@ "extends": "expo/tsconfig.base", "compilerOptions": { "strict": true, + "baseUrl": "../..", "paths": { - "@/*": ["./*"], - "react-native-reanimated": ["../../packages/react-native-reanimated/src"] + "@/*": ["./apps/common-app/src/*"] + // "react-native-reanimated": ["./packages/react-native-reanimated/src"] } }, "include": ["**/*.ts", "**/*.tsx"] diff --git a/packages/react-native-reanimated/src/css/component/createAnimatedComponent.tsx b/packages/react-native-reanimated/src/css/component/createAnimatedComponent.tsx index 696a6adef448..8e886c9f0559 100644 --- a/packages/react-native-reanimated/src/css/component/createAnimatedComponent.tsx +++ b/packages/react-native-reanimated/src/css/component/createAnimatedComponent.tsx @@ -1,5 +1,5 @@ 'use strict'; -import { forwardRef } from 'react'; +import React from 'react'; import type { FunctionComponent, ComponentClass, @@ -56,7 +56,7 @@ export default function createAnimatedComponent

( } } - return forwardRef((props, ref) => { + return React.forwardRef((props, ref) => { return (