Skip to content

Commit bdd11ad

Browse files
committed
extract and test types
1 parent f2c2970 commit bdd11ad

11 files changed

Lines changed: 5872 additions & 7096 deletions

File tree

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Typecheck Documentation Code Blocks
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- "**/*.mdx"
7+
- "**/typecheck.config.ts"
8+
- "scripts/typecheck-docs/**"
9+
push:
10+
branches: [main]
11+
paths:
12+
- "**/*.mdx"
13+
- "**/typecheck.config.ts"
14+
- "scripts/typecheck-docs/**"
15+
schedule:
16+
- cron: "0 8 * * *" # Every day at 8:00 UTC
17+
18+
jobs:
19+
typecheck:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@v4
23+
24+
- uses: pnpm/action-setup@v4
25+
26+
- uses: actions/setup-node@v4
27+
with:
28+
node-version: "24"
29+
cache: "pnpm"
30+
31+
- run: pnpm install --frozen-lockfile
32+
33+
- name: Typecheck documentation code blocks
34+
run: pnpm typecheck:docs

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
node_modules
2+
.typecheck-output
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
import type { TypecheckConfig } from "../../scripts/typecheck-docs/config";
2+
3+
const config: TypecheckConfig = {
4+
lang: "ts",
5+
sdkPackage: "@photon-ai/advanced-imessage",
6+
importPreamble: `
7+
import type {
8+
AdvancedIMessage,
9+
ChatGuid,
10+
MessageGuid,
11+
AttachmentGuid,
12+
ScheduledMessageId,
13+
Chat,
14+
Message,
15+
AttachmentInfo,
16+
StreamedDownload,
17+
SendReceipt,
18+
CommandReceipt,
19+
ScheduledMessage,
20+
ScheduledMessageStatus,
21+
AddressInfo,
22+
ChatServiceType,
23+
TransferState,
24+
StickerPlacement,
25+
BackgroundInfo,
26+
TextFormatInput,
27+
} from "@photon-ai/advanced-imessage";
28+
29+
import {
30+
createClient,
31+
directChat,
32+
groupChat,
33+
parseChatGuid,
34+
MessageBuilder,
35+
MessageEffect,
36+
TextEffect,
37+
Reaction,
38+
ErrorCode,
39+
AuthenticationError,
40+
ConnectionError,
41+
NotFoundError,
42+
RateLimitError,
43+
ValidationError,
44+
IMessageError,
45+
} from "@photon-ai/advanced-imessage";
46+
`.trim(),
47+
declarePreamble: `
48+
declare const im: AdvancedIMessage;
49+
declare const chat: ChatGuid;
50+
declare const chatGuid: ChatGuid;
51+
declare const messageGuid: MessageGuid;
52+
declare const someMessageGuid: MessageGuid;
53+
declare const someGuid: MessageGuid;
54+
declare const guid: any;
55+
declare const attachmentGuid: AttachmentGuid;
56+
declare const scheduledMessageId: ScheduledMessageId;
57+
declare const imageBytes: Uint8Array;
58+
declare const videoBytes: Uint8Array;
59+
declare let token: string;
60+
declare const err: unknown;
61+
declare function sleep(ms: number): Promise<void>;
62+
declare function refreshToken(): Promise<string>;
63+
declare function process(...args: any[]): void;
64+
`.trim(),
65+
};
66+
67+
export default config;

legacy/typecheck.config.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import type { TypecheckConfig } from "../scripts/typecheck-docs/config";
2+
3+
const config: TypecheckConfig = {
4+
lang: "ts",
5+
sdkPackage: "@photon-ai/advanced-imessage-kit",
6+
importPreamble: `
7+
import { SDK } from "@photon-ai/advanced-imessage-kit";
8+
`.trim(),
9+
declarePreamble: `
10+
declare const sdk: ReturnType<typeof SDK>;
11+
declare const tomorrow9am: Date;
12+
`.trim(),
13+
};
14+
15+
export default config;

0 commit comments

Comments
 (0)