Skip to content

Commit e3a9a85

Browse files
Fix stylecheck issues in AI SDK examples
- Remove 'any' type assertion, use proper type narrowing - Fix import order with biome autofix
1 parent c393540 commit e3a9a85

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

typescript/ai-sdk-v5/src/plugin-file-parser/file-parser-all-sizes.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,17 @@
1313
* To run: bun run typescript/ai-sdk-v5/src/plugin-file-parser/file-parser-all-sizes.ts
1414
*/
1515

16-
import { createOpenRouter } from '@openrouter/ai-sdk-provider';
17-
import { generateText } from 'ai';
1816
import {
19-
type PdfSize,
2017
PDF_SIZES,
18+
type PdfSize,
19+
extractCode,
20+
formatSize,
21+
getPdfSize,
2122
readExpectedCode,
2223
readPdfAsDataUrl,
23-
getPdfSize,
24-
formatSize,
25-
extractCode,
2624
} from '@openrouter-examples/shared/fixtures';
25+
import { createOpenRouter } from '@openrouter/ai-sdk-provider';
26+
import { generateText } from 'ai';
2727

2828
const openrouter = createOpenRouter({
2929
apiKey: process.env.OPENROUTER_API_KEY,

typescript/ai-sdk-v5/src/plugin-file-parser/file-parser-pdf-url.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,9 @@ async function main() {
6767
console.log(`- Completion tokens: ${result.usage.completionTokens}`);
6868
console.log(`- Total tokens: ${result.usage.totalTokens}`);
6969

70-
const cost = (result.providerMetadata?.openrouter?.usage as any)?.cost;
71-
if (cost) {
70+
const usage = result.providerMetadata?.openrouter?.usage;
71+
if (usage && typeof usage === 'object' && 'cost' in usage) {
72+
const cost = usage.cost as number;
7273
console.log(`\nCost: $${cost.toFixed(6)}`);
7374
}
7475

typescript/shared/src/fixtures.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* using absolute paths so examples work regardless of where they're run from.
66
*/
77

8-
import { join, dirname } from 'node:path';
8+
import { dirname, join } from 'node:path';
99
import { fileURLToPath } from 'node:url';
1010

1111
// Calculate absolute path to fixtures directory

0 commit comments

Comments
 (0)