Skip to content

Commit 95b9959

Browse files
authored
test: type-check README quickstart example (#21)
Add a compile-only quickstart example that mirrors the README client setup without sending a request. Run TypeScript checking from the existing test script so the example stays covered by the normal test gate. Signed-off-by: kittydev <108918571+11suixing11@users.noreply.github.com>
1 parent e9aa6fa commit 95b9959

2 files changed

Lines changed: 18 additions & 0 deletions

File tree

examples/readme-quickstart.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// SPDX-FileCopyrightText: 2026 Xquik contributors
2+
//
3+
// SPDX-License-Identifier: Apache-2.0
4+
5+
import XTwitterScraper from 'x-twitter-scraper';
6+
7+
// Compile-only mirror of the README quickstart. It intentionally constructs
8+
// the client and request params without sending a network request.
9+
const client = new XTwitterScraper({
10+
apiKey: process.env['X_TWITTER_SCRAPER_API_KEY'],
11+
});
12+
13+
const searchParams: XTwitterScraper.X.TweetSearchParams = { q: 'from:elonmusk', limit: 10 };
14+
15+
void client;
16+
void searchParams;

scripts/test

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ set -e
88

99
cd "$(dirname "$0")/.."
1010

11+
echo "==> Checking types"
12+
./node_modules/typescript/bin/tsc --project tsconfig.json --noEmit
1113

1214

1315
echo "==> Running tests"

0 commit comments

Comments
 (0)