cube-js / cube-js/cube

Deprecation warning but TypeScript still refers to deprecated value

Open
#7,315 3 comments 2 reactions 2 assignees Claimed by @c-kirkeby View on GitHub
client:react help wanted
Dominant language
Rust
Stars
20.8k
Forks
2.1k
Avg merge
1d 2h
Merged PRs (30d)
181

Description

**Describe the bug**
The new version of the React client library gives a deprecation warning if you pass the prop `cubejsApi` to `CubeProvider` but gives type errors if you use the new `cubeApi` value.

Looks like this was introduced in https://github.com/cube-js/cube/pull/7300

**To Reproduce**
Install `@cubejs-client/react@0.34.9`.

Create a

**Expected behavior**
The `CubeProviderProps` type should contain the `cubeApi` type.

**Screenshots**
![image](https://github.com/cube-js/cube/assets/820173/c53de57c-c1a6-4632-bf8c-dd89b4da1e27)

**Minimally reproducible Cube Schema**
N/A

**Version:**
`@cubejs-client/react@0.34.9`

**Additional context**
Happy to raise a PR to fix - seems like it'd be a matter of changing the `index.d.ts` file.

I've locally patched it like this:

```sh
diff --git a/index.d.ts b/index.d.ts
index 17cabc64b86b4fa9ca5939853d88efc0cf3969f2..1347bc67bff3ab64d22622685a73e6af3dcd6134 100644
--- a/index.d.ts
+++ b/index.d.ts
@@ -39,7 +39,8 @@ declare module '@cubejs-client/react' {
}

type CubeProviderProps = {
- cubejsApi: CubejsApi | null;
+ cubejsApi?: CubejsApi | null;
+ cubeApi: CubejsApi | null;
options?: CubeProviderOptions;
children: React.ReactNode;
};
```
Please let me know if there are any issues with this approach.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.