Skip to content

Replace deepClone with structuredClone#10876

Draft
timotheeguerin wants to merge 1 commit into
microsoft:mainfrom
timotheeguerin:timotheeguerin/fantastic-guide
Draft

Replace deepClone with structuredClone#10876
timotheeguerin wants to merge 1 commit into
microsoft:mainfrom
timotheeguerin:timotheeguerin/fantastic-guide

Conversation

@timotheeguerin
Copy link
Copy Markdown
Member

Replace the custom deepClone utility and JSON.parse(JSON.stringify(...)) patterns with structuredClone.

Changes

  • Replaced all internal deepClone() calls with structuredClone()
  • Replaced JSON.parse(JSON.stringify(...)) deep copy patterns with structuredClone()
  • Deprecated the public deepClone export with @deprecated JSDoc tag (kept for backward compat)
  • Cleaned up unused imports

@microsoft-github-policy-service microsoft-github-policy-service Bot added compiler:core Issues for @typespec/compiler lib:http lib:http-specs For issues/prs related to the @typespec/http-specs package labels Jun 3, 2026
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Jun 3, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@typespec/compiler@10876
npm i https://pkg.pr.new/@typespec/http@10876
npm i https://pkg.pr.new/@typespec/http-specs@10876

commit: 9f92168

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 3, 2026

All changed packages have been documented.

  • @typespec/compiler
  • @typespec/http-specs
  • @typespec/http
Show changes

@typespec/http-specs - internal ✏️

Replace JSON.parse(JSON.stringify(...)) with structuredClone.

@typespec/http - internal ✏️

Replace internal deepClone usage with structuredClone.

@typespec/compiler - deprecation ✏️

Deprecated deepClone utility in favor of structuredClone. All internal usages have been replaced with the native structuredClone API.

@timotheeguerin timotheeguerin force-pushed the timotheeguerin/fantastic-guide branch from e451e6e to 248eac4 Compare June 3, 2026 17:02
@azure-sdk-automation
Copy link
Copy Markdown

azure-sdk-automation Bot commented Jun 3, 2026

You can try these changes here

🛝 Playground 🌐 Website 🛝 VSCode Extension

@timotheeguerin timotheeguerin force-pushed the timotheeguerin/fantastic-guide branch 3 times, most recently from ef7f626 to a824392 Compare June 3, 2026 17:42
…Clone

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@timotheeguerin timotheeguerin force-pushed the timotheeguerin/fantastic-guide branch from a824392 to 9f92168 Compare June 3, 2026 17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

compiler:core Issues for @typespec/compiler lib:http lib:http-specs For issues/prs related to the @typespec/http-specs package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant