Skip to content

Migrate playroom internals to TypeScript#313

Closed
TheMightyPenguin wants to merge 12 commits into
seek-oss:masterfrom
TheMightyPenguin:migrate-internals-to-typescript
Closed

Migrate playroom internals to TypeScript#313
TheMightyPenguin wants to merge 12 commits into
seek-oss:masterfrom
TheMightyPenguin:migrate-internals-to-typescript

Conversation

@TheMightyPenguin

Copy link
Copy Markdown
Contributor

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.

@TheMightyPenguin TheMightyPenguin requested a review from a team as a code owner January 6, 2024 06:05
@changeset-bot

changeset-bot Bot commented Jan 6, 2024

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 4425d38

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
playroom Patch

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

@TheMightyPenguin

Copy link
Copy Markdown
Contributor Author

@michaeltaranto @askoufis breaking down the Vite PR into smaller ones, this migrates files in the src/ folder to TypeScript, still somewhat chunky but should be easier to review as it should maintain the same current Playroom behavior.

@askoufis askoufis left a comment

Copy link
Copy Markdown
Contributor

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.

Comment thread package.json
Comment on lines +5 to +6
"main": "utils/index.ts",
"types": "utils/index.ts",

@askoufis askoufis Jan 23, 2024

Copy link
Copy Markdown
Contributor

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 (if necessary) later.

Copy link
Copy Markdown
Contributor

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.

Comment thread src/Playroom/Frame.tsx
themes: Record<string, any>;
components: Array<any>;
FrameComponent: React.ComponentType<{
components: Record<string, ComponentType>;

Copy link
Copy Markdown
Contributor

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>;

@askoufis askoufis Jan 23, 2024

Copy link
Copy Markdown
Contributor

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.

@michaeltaranto

Copy link
Copy Markdown
Contributor

Closing this PR, as we broke the work down into #422, #421, #419 and #418.

Thanks so much for all the effort in this space, apologies we have not been able to focus on this earlier.

❤️

@TheMightyPenguin

Copy link
Copy Markdown
Contributor Author

@michaeltaranto thanks! I mean I also haven't follow up in like a year so appreciate seeing this making its way into the repo in some way 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants