Skip to content

schema: handle typedefs without a parsed signature - #40

Merged
rumblefrog merged 1 commit into
masterfrom
claude/schema-null-signature
Sep 25, 2026
Merged

rumblefrog merged 1 commit into
masterfrom
claude/schema-null-signature

Conversation

@rumblefrog

Copy link
Copy Markdown
Member

Problem

Searching a bundle from the new tree-sitter parser (#30) crashes the frontend:

TypeError: Cannot read properties of null (reading 'arguments')
    at TypeDefinition.searchEntries

The parser sets parsedSignature: null when a typedef or typeset member isn't a function signature, for example typedef Address = int. That matches Option<TypeSignature> in libschema. The TS schema typed the field as always present. The search code before #32 made the same assumption, so it would also have rejected on these bundles. Bundles from the previous parser never contain null, which is why this went unnoticed.

Fix

  • parsedSignature is now ITypeSignature | null on ITypeDefinition, IType and the TypeDefinition class.
  • Search indexes only the name of a typedef whose signature is null, and skips typeset members whose signature is null.
  • @sourcemod-dev/schema is bumped to 0.1.19 so the fix can be published.

Verification

  • search_index.test.ts now includes a typedef and a typeset member with parsedSignature: null. With the fix reverted, the test fails with the same TypeError. With the fix, all 8 tests pass.
  • tsc --noEmit passes.
  • I re-ran the side-by-side comparison against the previous implementation on all 22 bundles on the bundles branch of sourcemod-dev/manifest: zero differences.

🤖 Generated with Claude Code

https://claude.ai/code/session_01NLCPZBzDzF1cP5qKEEhEsg


Generated by Claude Code

The tree-sitter parser emits parsedSignature: null for typedefs and
typeset members that aren't function signatures, such as
`typedef Address = int`, matching Option<TypeSignature> in libschema.
The TS schema typed it as always present, so searching a bundle with one
threw on `.arguments`.

Type parsedSignature as nullable and index only the name when it's null.
Bumps the schema to 0.1.19.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NLCPZBzDzF1cP5qKEEhEsg
@rumblefrog
rumblefrog merged commit e77cfb4 into master Sep 25, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants