-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix ts errors when remix-sdk client is imported #11
base: main
Are you sure you want to change the base?
Conversation
@@ -31,6 +30,7 @@ class LDBrowser extends Component<LDBrowserProps, HocState> { | |||
} | |||
|
|||
render() { | |||
// eslint-disable-next-line react/react-in-jsx-scope |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix for issue 1 - removing React
on line 1 above fixes the issue, but eslint
will flag the line below.
@@ -10,5 +10,6 @@ interface LDContext { | |||
const context = createContext<LDContext>({ flags: {}, ldClient: undefined, user: undefined }); | |||
const { Provider, Consumer } = context; | |||
|
|||
export { Provider, Consumer, LDContext }; | |||
export { Provider, Consumer }; | |||
export type { LDContext }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix for issue 5.
clientSideID: string; | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix for issues 2, 3, and 4. For some reason, tsc
isn't able to access the globals.d.ts
file in this project when client is pulled in.
publishing the package to npm would probably solve these type issues, but this helps for now. |
@yusinto tagging you for review! For some reason I can't edit the assignees |
@kronkm thanks for this! I'll review this soon. |
@kronkm are you able to share your strict tsconfig.json so I can reproduce these errors please? We have some work to improve the build for this remix sdk to make it more consumable and I want to make sure these PR is in line with that. Thank you. |
Sure thing! Here ya go, and running
|
@kronkm these are issues arising due to your application consuming the src files directly. If you run // this
import { useFlags } from 'remix-sdk/client'; This way most of the errors you see should go away. Please note we are seeing these errors because it's hard to use the remix-sdk because it's not published on npm yet. Once published, these problems should also go away. We hope to do this soon. |
Fixing type errors that are thrown when the
remix-sdk
client exports are pulled into a project with strictertsconfig
options and imported via:import { useFlags } from 'node_modules/remix-sdk/src/client';
My project is using
typescript@4.7.4
. Right now, projects with stricter TS settings can throw these errors:1:
2, 3, 4:
5: