Closed tmyroadctfig closed 6 months ago
Looks like both of your issues might be caused by an incompatible Typescript setup. I suspect you might be using React 18.3 types, which I haven't tried updating yet.
I updated packages and ReactUnity types seems to be compatible with latest version of TS and React.
I suspect your tsconfig may not be set-up correctly. Here is a tsconfig file that should work well:
{
"extends": "@reactunity/scripts",
"compilerOptions": {
"baseUrl": "./",
"jsxImportSource": "@reactunity/renderer/ugui",
"types": [
"@reactunity/scripts/main"
]
},
"files": [
"./src/index.tsx"
],
"include": [
"./src"
]
}
Also it seems unhappy about objectFit: TS2322: Type '"fit"' is not assignable to type 'ObjectFit'.
fit
is not a correct value for objectFit
. This was a mistake on docs, and now fixed. See MDN for correct values.
Thank you, adding "jsxImportSource": "@reactunity/renderer/ugui",
fixed the issue after I also bumped my nodejs version to v20 (🤷♂️).
This was a mistake on docs, and now fixed.
👍 I realised that afterwards, but it's good the docs have the typo fixed.
I suspect you might be using React 18.3 types
Yep, seems that way: "@types/react@^18.3.1":
I'm getting:
on something like:
Also it seems unhappy about
objectFit
: TS2322: Type '"fit"' is not assignable to type 'ObjectFit'.