@discord/markdown-types 0.1.3 → 0.1.4

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 +71 -42
  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:
8
9
  export type AnyNode<T = any, V = any> = Node<T, V> | EmptyNode<T>;
9
10
 
10
11
  // base
@@ -20,77 +21,105 @@ 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
+ guild_id: string | "@me";
36
+ channel_id: string;
37
+ }
38
+ >;
39
+ export type MessageMentionLink = Node<
40
+ "message",
41
+ {
42
+ guild_id: string | "@me";
43
+ channel_id: string;
44
+ message_id: string;
45
+ }
46
+ >;
47
+ export type AttachmentMentionLink = Node<
48
+ "attachment",
49
+ {
50
+ channel_id: string;
51
+ attachment_id: string;
52
+ name: string;
53
+ }
54
+ >;
55
+ export type MentionLink = Node<
56
+ "mention",
57
+ ChannelMentionLink | MessageMentionLink | AttachmentMentionLink
58
+ >;
32
59
 
33
60
  export type Link = Node<"link", NormalLink | MentionLink>;
34
61
 
35
62
  export type UserMention = Node<"user", string>;
36
63
  export type ChannelMention = Node<"channel", string>;
37
64
  export type RoleMention = Node<"role", string>;
65
+ export type GameMention = Node<"game", string>;
38
66
  export type CommandMention = Node<"command", { name: string; id: string }>;
39
67
  export type EveryoneMention = EmptyNode<"everyone">;
40
68
  export type HereMention = EmptyNode<"here">;
41
69
  export type Mention = Node<
42
- "mention",
43
- | UserMention
44
- | ChannelMention
45
- | RoleMention
46
- | CommandMention
47
- | EveryoneMention
48
- | HereMention
70
+ "mention",
71
+ | UserMention
72
+ | ChannelMention
73
+ | RoleMention
74
+ | GameMention
75
+ | CommandMention
76
+ | EveryoneMention
77
+ | HereMention
49
78
  >;
50
79
 
51
80
  export type Timestamp = Node<"timestamp", { value: string; style?: string }>;
52
81
 
53
82
  export type CustomEmoji = Node<
54
- "custom",
55
- { animated: boolean; name: string; id: string }
83
+ "custom",
84
+ { animated: boolean; name: string; id: string }
56
85
  >;
57
86
  export type UnicodeEmoji = Node<"unicode", string>;
58
87
  export type Emoji = Node<"emoji", CustomEmoji | UnicodeEmoji>;
59
88
 
60
89
  export type CodeBlock = Node<
61
- "code_block",
62
- { language?: string; content: string }
90
+ "code_block",
91
+ { language?: string; content: string }
63
92
  >;
64
93
 
65
94
  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;
95
+ | Bold
96
+ | Code
97
+ | CodeBlock
98
+ | Emoji
99
+ | Italic
100
+ | Link
101
+ | Mention
102
+ | Spoiler
103
+ | Strikethrough
104
+ | Timestamp
105
+ | Underline;
77
106
 
78
107
  export type Heading = Node<
79
- "heading",
80
- {
81
- level: number;
82
- content: Inline[];
83
- }
108
+ "heading",
109
+ {
110
+ level: number;
111
+ content: Inline[];
112
+ }
84
113
  >;
85
114
 
86
115
  export type ListItem = { content: (List | Paragraph)[] };
87
116
  export type List = Node<
88
- "list",
89
- {
90
- type: "unordered" | "ordered";
91
- value?: number;
92
- items: ListItem[];
93
- }
117
+ "list",
118
+ {
119
+ type: "unordered" | "ordered";
120
+ value?: number;
121
+ items: ListItem[];
122
+ }
94
123
  >;
95
124
  export type Empty = EmptyNode<"empty">;
96
125
  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.1.4",
4
4
  "description": "TypeScript types for Discord Markdown AST nodes",
5
5
  "types": "index.d.ts",
6
6
  "keywords": [],