Verify Package Types
Use this skill when:
- •You encounter a TypeScript error (e.g., "Property 'x' does not exist on type 'y'") for a third-party package.
- •You are unsure if a specific feature or configuration option is supported by the installed version of a package.
- •You suspect a version mismatch between your training data (docs) and the actual installed package.
Strategy
Do not guess package capabilities. The source of truth is the code sitting on the disk in node_modules.
Application Rules
- •
Locate the Entry Point:
- •Check
package.jsonto see the installed version. - •Look at
node_modules/<package_name>/package.jsonto find thetypesortypingsfield. - •If no
typesfield, look forindex.d.tsin the root ordistfolder.
- •Check
- •
Inspect Definition Files:
- •Use
view_fileto read the.d.tsfile. - •Search for the specific function, class, or interface you are trying to use.
- •Check the function signature, accepted parameters, and their types.
- •Look for exported types that might match what you need.
- •Use
- •
Check for "maxSteps" and "Stream" Usage (Common Issues):
- •For Vercel AI SDK (
ai),streamTextandgenerateTextoptions change frequently between versions. - •Always verify if
maxSteps,maxToolRoundtrips, or similar properties exist in theSettingsinterface.
- •For Vercel AI SDK (
- •
Resolve Discrepancies:
- •If the feature you want to use is missing from the types:
- •logic: It probably doesn't exist in this version. Do not use
@ts-ignoreunless you have verified viagrepthat the runtime code actually supports it but the types are missing (rare). - •Action: Use an alternative API that is present in the type definition, or suggest upgrading the package to the user.
- •logic: It probably doesn't exist in this version. Do not use
- •If the feature you want to use is missing from the types:
Example Workflow
User Request: "Fix the error: maxSteps does not exist in streamText"
- •Check Package Version:
view_file package.json-> see"ai": "^3.0.0" - •Locate Types:
find_by_name node_modules/ai -e d.ts-> founddist/index.d.ts - •Read Definitions:
view_file node_modules/ai/dist/index.d.ts - •Search: Grep for
maxSteps.- •Result: Not found.
- •Alternative Search: Grep for
maxRetriesorroundtripsto see what is supported. - •Conclusion: "The installed version 3.0.0 does not support
maxSteps. We must usemaxToolRoundtripsinstead, or upgrade to version 3.1+."