-
Notifications
You must be signed in to change notification settings - Fork 185
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
Migrate playroom internals to TypeScript #313
base: master
Are you sure you want to change the base?
Migrate playroom internals to TypeScript #313
Conversation
🦋 Changeset detectedLatest commit: 4425d38 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@michaeltaranto @askoufis breaking down the Vite PR into smaller ones, this migrates files in the |
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.
Thanks for splitting out the PR. Just a few comments.
"main": "utils/index.ts", | ||
"types": "utils/index.ts", |
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.
Do we want to ship typescript as source? The alternative would be a build step. We could just run tsc
for now, and graduate to something that offers proper CJS/ESM support later.
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.
Reflecting on this, maybe for now we could just keep the separate .js
and .d.ts
files for simplicity, and think about a potential build process later on.
import RenderCode from './RenderCode/RenderCode'; | ||
|
||
interface FrameProps { | ||
themes: Record<string, any>; | ||
components: Array<any>; | ||
FrameComponent: React.ComponentType<{ | ||
components: Record<string, ComponentType>; |
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.
Should this be ComponentType<any>
so it will accept any component? Leaving out the generic argument results in it defaulting to {}
, so only components that don't take any props would be accepted.
scope, | ||
}: { | ||
code: string | undefined; | ||
scope: Record<string, ComponentType>; |
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.
I don't think ComponentType
is correct here. You can inject whatever you want with scope
, a constant, a function, a component, etc. Maybe Record<string, any>
would be more appropriate.
Migrates internals to TypeScript. This PR is the first in a series of changes aiming to support Vite. This is the original PR #285, but following Michael suggestion to split up the work.