@discord/markdown-types 0.1.3 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.d.ts +80 -47
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -1,10 +1,11 @@
1
1
  export type Node<T, V> = {
2
- type: T;
3
- value: V;
2
+ type: T;
3
+ value: V;
4
4
  };
5
5
 
6
6
  export type EmptyNode<T> = { type: T; value?: never };
7
7
 
8
+ // biome-ignore lint/suspicious/noExplicitAny: this is explicitly any
8
9
  export type AnyNode<T = any, V = any> = Node<T, V> | EmptyNode<T>;
9
10
 
10
11
  // base
@@ -20,77 +21,109 @@ export type Italic = Node<"italic", Inline[]>;
20
21
  export type Bold = Node<"bold", Inline[]>;
21
22
 
22
23
  export type NormalLink = Node<
23
- "normal",
24
- {
25
- text?: Exclude<Inline, Link>[];
26
- url: string;
27
- title?: string;
28
- }
24
+ "normal",
25
+ {
26
+ text?: Exclude<Inline, Link>[];
27
+ url: string;
28
+ title?: string;
29
+ }
29
30
  >;
30
31
 
31
- export type MentionLink = Node<"mention", any>;
32
+ export type ChannelMentionLink = Node<
33
+ "channel",
34
+ {
35
+ domain: string;
36
+ guild_id: bigint | "@me";
37
+ channel_id: bigint;
38
+ }
39
+ >;
40
+ export type MessageMentionLink = Node<
41
+ "message",
42
+ {
43
+ domain: string;
44
+ guild_id: bigint | "@me";
45
+ channel_id: bigint;
46
+ message_id: bigint;
47
+ }
48
+ >;
49
+ export type AttachmentMentionLink = Node<
50
+ "attachment",
51
+ {
52
+ domain: string;
53
+ ephemeral: boolean;
54
+ channel_id: bigint;
55
+ attachment_id: bigint;
56
+ name: string;
57
+ }
58
+ >;
59
+ export type MentionLink = Node<
60
+ "mention",
61
+ ChannelMentionLink | MessageMentionLink | AttachmentMentionLink
62
+ >;
32
63
 
33
64
  export type Link = Node<"link", NormalLink | MentionLink>;
34
65
 
35
- export type UserMention = Node<"user", string>;
36
- export type ChannelMention = Node<"channel", string>;
37
- export type RoleMention = Node<"role", string>;
38
- export type CommandMention = Node<"command", { name: string; id: string }>;
66
+ export type UserMention = Node<"user", bigint>;
67
+ export type ChannelMention = Node<"channel", bigint>;
68
+ export type RoleMention = Node<"role", bigint>;
69
+ export type GameMention = Node<"game", bigint>;
70
+ export type CommandMention = Node<"command", { name: string; id: bigint }>;
39
71
  export type EveryoneMention = EmptyNode<"everyone">;
40
72
  export type HereMention = EmptyNode<"here">;
41
73
  export type Mention = Node<
42
- "mention",
43
- | UserMention
44
- | ChannelMention
45
- | RoleMention
46
- | CommandMention
47
- | EveryoneMention
48
- | HereMention
74
+ "mention",
75
+ | UserMention
76
+ | ChannelMention
77
+ | RoleMention
78
+ | GameMention
79
+ | CommandMention
80
+ | EveryoneMention
81
+ | HereMention
49
82
  >;
50
83
 
51
- export type Timestamp = Node<"timestamp", { value: string; style?: string }>;
84
+ export type Timestamp = Node<"timestamp", { value: bigint; style?: string }>;
52
85
 
53
86
  export type CustomEmoji = Node<
54
- "custom",
55
- { animated: boolean; name: string; id: string }
87
+ "custom",
88
+ { animated: boolean; name: string; id: bigint }
56
89
  >;
57
90
  export type UnicodeEmoji = Node<"unicode", string>;
58
91
  export type Emoji = Node<"emoji", CustomEmoji | UnicodeEmoji>;
59
92
 
60
93
  export type CodeBlock = Node<
61
- "code_block",
62
- { language?: string; content: string }
94
+ "code_block",
95
+ { language?: string; content: string }
63
96
  >;
64
97
 
65
98
  export type Inline =
66
- | Bold
67
- | Code
68
- | CodeBlock
69
- | Emoji
70
- | Italic
71
- | Link
72
- | Mention
73
- | Spoiler
74
- | Strikethrough
75
- | Timestamp
76
- | Underline;
99
+ | Bold
100
+ | Code
101
+ | CodeBlock
102
+ | Emoji
103
+ | Italic
104
+ | Link
105
+ | Mention
106
+ | Spoiler
107
+ | Strikethrough
108
+ | Timestamp
109
+ | Underline;
77
110
 
78
111
  export type Heading = Node<
79
- "heading",
80
- {
81
- level: number;
82
- content: Inline[];
83
- }
112
+ "heading",
113
+ {
114
+ level: number;
115
+ content: Inline[];
116
+ }
84
117
  >;
85
118
 
86
119
  export type ListItem = { content: (List | Paragraph)[] };
87
120
  export type List = Node<
88
- "list",
89
- {
90
- type: "unordered" | "ordered";
91
- value?: number;
92
- items: ListItem[];
93
- }
121
+ "list",
122
+ {
123
+ type: "unordered" | "ordered";
124
+ value?: number;
125
+ items: ListItem[];
126
+ }
94
127
  >;
95
128
  export type Empty = EmptyNode<"empty">;
96
129
  export type Quote = Node<"quote", Block[]>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@discord/markdown-types",
3
- "version": "0.1.3",
3
+ "version": "0.2.0",
4
4
  "description": "TypeScript types for Discord Markdown AST nodes",
5
5
  "types": "index.d.ts",
6
6
  "keywords": [],