Skip to content

Studio: Resolve type error for blueprint steps - #2694

Merged
katinthehatsite merged 2 commits into
trunkfrom
fix/error-in-site-create-blueprints-steps
Mar 4, 2026
Merged

Studio: Resolve type error for blueprint steps#2694
katinthehatsite merged 2 commits into
trunkfrom
fix/error-in-site-create-blueprints-steps

Conversation

@katinthehatsite

Copy link
Copy Markdown
Contributor

Related issues

N/A

I noticed this issue while working on something else.

Proposed Changes

This PR resolves the type error in studio/apps/cli/commands/site/create.ts:

Property 'steps' does not exist on type 'Blueprint'.
  Property 'steps' does not exist on type 'ReadableFilesystemBackend'.

Testing Instructions

  • Pull the changes from this branch
  • Try creating a Studio site and confirm you can create it with no further errors
  • Open studio/apps/cli/commands/site/create.ts and confirm there are no type errors

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?
@katinthehatsite katinthehatsite self-assigned this Mar 3, 2026
@katinthehatsite
katinthehatsite requested a review from a team March 3, 2026 12:31
@wpmobilebot

wpmobilebot commented Mar 3, 2026

Copy link
Copy Markdown
Collaborator

📊 Performance Test Results

Comparing a952fba vs trunk

site-editor

Metric trunk a952fba Diff Change
load 1465.00 ms 1804.00 ms +339.00 ms 🔴 23.1%

site-startup

Metric trunk a952fba Diff Change
siteCreation 7069.00 ms 7082.00 ms +13.00 ms ⚪ 0.0%
siteStartup 3918.00 ms 3931.00 ms +13.00 ms ⚪ 0.0%

Results are median values from multiple test runs.

Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff)

@epeicher epeicher 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 @katinthehatsite! I can confirm that I no longer see the type errors. LGTM! :shipit:

Before After
Image Image

I think the package-lock.json changes are not required, and if you merge with latest trunk the E2E error will be fixed

}
const existingSteps = blueprint.steps || [];
blueprint.steps = [ ...setupSteps, ...existingSteps ];
const blueprintDecl = blueprint as BlueprintV1Declaration;

@nightnei nightnei Mar 3, 2026

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 see error in my Cursor, maybe something is broken in my local configuration, but in general the solution seems like a workaround for wp-playground and we need to report it.
What concerns me is:

  1. Above in the code we define let blueprint: Blueprint | undefined;
  2. Under the hood we have export type Blueprint = BlueprintV1 | BlueprintV2;
  3. Under the hood of the previous statement, we have export type BlueprintV1 = BlueprintV1Declaration | BlueprintBundle;
  4. So, ultimately it should be BlueprintV1Declaration. Since you see that error and casting as BlueprintV1Declaration fixes the issue, then we indeed should report this ts bug instead of adding workaround.

It's ts, so it shouldn't affect anything, and I would go with keeping the error as is and reporting the bug. Unless it breaks something right now, but it seems it isn't.
But as a temporary solution, I think we can go with the approach in this PR.

WDYT? Am I missing something?

UPDATE: restarting the Cursor - showed the error to me.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can merge this for now and I will report this to Playground team. It is likely will be marked a low priority so it might take a while for the fix to come in.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added follow up here: WordPress/wordpress-playground#3336

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.

This isn't a safe type assertion. Typescript is flagging a legitimate type error here.

I recommend changing the type of the let blueprint declaration to BlueprintV1Declaration. This will require us to also change the return type of filterUnsupportedBlueprintFeatures, and potentially some other related functions. All of this is what we want, though, because BlueprintV1Declaration is the data format we support.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will take a look 👀

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 went down a rabbit hole with this and ended up publishing #2719, which addresses the problem and some related issues.

@gcsecsey gcsecsey left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @katinthehatsite for fixing this. This LGTM and I see no more issues on the create file. 👍

Also, when creating a new site, I see no errors:

Image

@nightnei nightnei 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.

The changes are fixing the issue 👍 So feel free to move forward and merge it. I just shared my thoughts above.

@katinthehatsite
katinthehatsite merged commit 7f6d95c into trunk Mar 4, 2026
11 checks passed
@katinthehatsite
katinthehatsite deleted the fix/error-in-site-create-blueprints-steps branch March 4, 2026 10:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

6 participants