Summary
@github/copilot-sdk@1.0.8 generates a SessionEvent union that references AssistantTurnRetryEvent and ModelCallStartEvent, but neither interface is declared.
Because the union contains unresolved type names, TypeScript resolves SessionEvent to any when declaration checking is skipped. This propagates to SessionEventType, SessionEventPayload, and every callback registered through CopilotSession.on().
Expected Behavior
The generated declarations should compile without missing-type errors. SessionEventPayload<'skill.invoked'> and every other event payload should preserve its declared structure, and session.on() callbacks should receive typed events.
Actual Behavior
The SDK declarations produce these errors when skipLibCheck is disabled:
dist/generated/session-events.d.ts: Cannot find name 'AssistantTurnRetryEvent'.
dist/generated/session-events.d.ts: Cannot find name 'ModelCallStartEvent'.
With skipLibCheck enabled, TypeScript silently resolves SessionEvent to any. For example, the following invalid access compiles:
const event: SessionEventPayload<'skill.invoked'> = null as never
event.notARealProperty
const invalid: number = event.data.name
This affects skill events as well as all other session events. In particular, an unannotated skill callback parameter is reported as implicit any:
error TS7006: Parameter 'skill' implicitly has an 'any' type.
Steps to Reproduce
- Install
@github/copilot-sdk@1.0.8.
- Run TypeScript with
skipLibCheck: false.
- Observe the two missing generated event types listed above.
- Alternatively, enable
skipLibCheck and compile code that consumes a session event:
session.on('skill.invoked', (event) => {
const invalid: number = event.data.name
event.notARealProperty
})
- TypeScript accepts the invalid assignment and property access because
event is any.
Environment
- OS: macOS
- Node version: 24.17.0
@github/copilot-sdk version: 1.0.8
- TypeScript: repository build invoked via
bun at build
Evidence
The SDK derives callback payloads from SessionEvent:
export type SessionEventType = SessionEvent['type']
export type SessionEventPayload<T extends SessionEventType> = Extract<
SessionEvent,
{ type: T }
>
export type TypedSessionEventHandler<T extends SessionEventType> = (
event: SessionEventPayload<T>
) => void
The generated SessionEvent union references AssistantTurnRetryEvent and ModelCallStartEvent, but neither is present in dist/generated/session-events.d.ts.
Workaround
Consumers can explicitly annotate event values with individual exported event interfaces where needed:
session.on('skill.invoked', (event: SkillInvokedEvent) => {
const skillName = event.data.name
})
This restores type checking locally but should not be required once SessionEvent is valid.
Suggested Fix
Update the event-union generator so every referenced event interface is emitted. In particular, either emit AssistantTurnRetryEvent and ModelCallStartEvent, or remove them from SessionEvent until they are defined.
export type SessionEvent =
| /* existing event types */
| AssistantTurnRetryEvent
| ModelCallStartEvent
Summary
@github/copilot-sdk@1.0.8generates aSessionEventunion that referencesAssistantTurnRetryEventandModelCallStartEvent, but neither interface is declared.Because the union contains unresolved type names, TypeScript resolves
SessionEventtoanywhen declaration checking is skipped. This propagates toSessionEventType,SessionEventPayload, and every callback registered throughCopilotSession.on().Expected Behavior
The generated declarations should compile without missing-type errors.
SessionEventPayload<'skill.invoked'>and every other event payload should preserve its declared structure, andsession.on()callbacks should receive typed events.Actual Behavior
The SDK declarations produce these errors when
skipLibCheckis disabled:With
skipLibCheckenabled, TypeScript silently resolvesSessionEventtoany. For example, the following invalid access compiles:This affects skill events as well as all other session events. In particular, an unannotated
skillcallback parameter is reported as implicitany:Steps to Reproduce
@github/copilot-sdk@1.0.8.skipLibCheck: false.skipLibCheckand compile code that consumes a session event:eventisany.Environment
@github/copilot-sdkversion: 1.0.8bun at buildEvidence
The SDK derives callback payloads from
SessionEvent:The generated
SessionEventunion referencesAssistantTurnRetryEventandModelCallStartEvent, but neither is present indist/generated/session-events.d.ts.Workaround
Consumers can explicitly annotate event values with individual exported event interfaces where needed:
This restores type checking locally but should not be required once
SessionEventis valid.Suggested Fix
Update the event-union generator so every referenced event interface is emitted. In particular, either emit
AssistantTurnRetryEventandModelCallStartEvent, or remove them fromSessionEventuntil they are defined.