Skip to content

Commit 53c7603

Browse files
committed
fix: handle missing optional dependency in declarations
1 parent 8c4f8ee commit 53c7603

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

fix-optional-dep-types.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
set -euo pipefail
3+
4+
# Iterate through all *.d.ts files in the dist directory
5+
find dist -type f -name "*.d.ts" | while read -r file; do
6+
# Log file name and line number for matches
7+
grep -n "^import .* from '@stream-io/openai-realtime-api';" "$file" | while IFS=: read -r linenum _; do
8+
echo "Adding ts-ignore to declaration: $file:$linenum"
9+
done || true
10+
11+
# Use sed to prepend the comment to matching import statements
12+
sed -i '' '/^import .* from '\''@stream-io\/openai-realtime-api'\'';/i\
13+
// @ts-ignore Optional dependency
14+
' "$file" || true
15+
done
16+

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"test": "vitest",
2525
"test:bun": "bun run vitest",
2626
"start": "rollup -w -c",
27-
"build": "rm -rf dist && rollup -c",
27+
"build": "rm -rf dist && rollup -c && ./fix-optional-dep-types.sh",
2828
"generate:open-api": "./generate-openapi.sh",
2929
"lint": "eslint **/*.ts",
3030
"lint:fix": "eslint --fix **/*.ts",

0 commit comments

Comments
 (0)