Add TypeScript drawing example mirroring Python drawing sample#336
Merged
Conversation
Copilot created this pull request from a session on behalf of
robgruen
June 1, 2026 21:30
View session
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a TypeScript counterpart to the Python drawing sample (PR #238): a new drawing example workspace that translates natural-language requests into a typed Drawing JSON via TypeChat and renders the result to SVG.
Changes:
- New
typescript/examples/drawingworkspace (package.json, src/tsconfig.json, README) wired into the examples workspaces. drawingSchema.tsdefiningDrawing/Box/Ellipse/Arrow/Style/UnknownText, plus amain.tsinteractive loop that joins request history before translating.render.tsthat emits SVG (rect/ellipse/line with arrowhead marker, fill/stroke/dash/rounded corners) and writes todist/drawing.svg.
Show a summary per file
| File | Description |
|---|---|
| typescript/examples/README.md | Adds Drawing to the canonical example list. |
| typescript/examples/drawing/README.md | New per-example README and usage instructions. |
| typescript/examples/drawing/package.json | New workspace manifest mirroring the math example. |
| typescript/examples/drawing/src/tsconfig.json | Strict TS build config for the example. |
| typescript/examples/drawing/src/drawingSchema.ts | New schema with shape, style, and unknown-text types (uses snake_case props). |
| typescript/examples/drawing/src/main.ts | Translator loop that appends to history before translating. |
| typescript/examples/drawing/src/render.ts | Converts Drawing to SVG primitives with style handling. |
| typescript/examples/drawing/src/input.txt | Sample iterative prompts. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 8/8 changed files
- Comments generated: 2
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
TalZaccai
approved these changes
Jun 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds a TypeScript example equivalent to the Python drawing sample from PR #238, so the same structured drawing workflow is available in both SDKs. It introduces schema-driven translation for drawing intents plus a renderer output path in the TypeScript examples set.
New
drawingexample workspacetypescript/examples/drawingwith its ownpackage.json,tsconfig, README, and sample prompts.Drawing schema + translator loop
drawingSchema.tswithDrawing,Box,Ellipse,Arrow,Style, andUnknownText.main.tsthat translates user input toDrawingJSON and keeps request history across turns to support iterative refinements.Renderer output
render.tsto convert translated drawing objects into SVG primitives (rect, ellipse, line with arrow marker), including style handling (fill/stroke/dash/corners).dist/drawing.svgon successful translations.Examples index update
typescript/examples/README.mdso it appears in the canonical example list.