Migrate to Pyndatic AI v2 - #111
Conversation
❌ Deploy Preview for agent-runtimes failed.
|
There was a problem hiding this comment.
Pull request overview
This PR addresses TypeScript build issues in the examples2 notebook mutation demos by adjusting the typing around the placeholder ServiceManagerLess instance used before a real JupyterLab ServiceManager is created.
Changes:
- Widen
serviceManagerReact state type to allow storing either a realServiceManager.IManageror theServiceManagerLessplaceholder. - Add
as ServiceManager.IManagerassertions when passingserviceManagerinto theNotebookcomponent to satisfy its prop type.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/examples2/NotebookMutationsServiceManager.tsx | Widen serviceManager state type to include ServiceManagerLess and cast back to IManager when rendering <Notebook/>. |
| src/examples2/NotebookMutationsKernel.tsx | Same typing adjustment and cast to resolve build typing issues for the kernel mutations example. |
Comments suppressed due to low confidence (2)
src/examples2/NotebookMutationsServiceManager.tsx:201
serviceManageris asserted toServiceManager.IManagerhere even though the component state allowsServiceManagerLess. IfServiceManagerLessdoesn’t actually implement all ofIManager, this can lead to runtime failures inside<Notebook/>while still compiling cleanly.
Prefer narrowing/guarding so <Notebook/> only receives a real ServiceManager.IManager, or refactor the placeholder manager so it truly conforms to IManager rather than relying on as casts.
onSessionConnection={onSessionConnection}
readonly={readonly}
serviceManager={serviceManager as ServiceManager.IManager}
/>
src/examples2/NotebookMutationsKernel.tsx:200
serviceManageris cast toServiceManager.IManagerhere even though the component state allowsServiceManagerLess. This bypasses compile-time checking and can cause runtime failures if<Notebook/>usesIManagermembers thatServiceManagerLessdoesn’t implement.
Prefer ensuring serviceManager is truly an IManager before rendering/passing it, rather than asserting the type at the call site.
onSessionConnection={onSessionConnection}
readonly={readonly}
serviceManager={serviceManager as ServiceManager.IManager}
/>
No description provided.