-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpurplet.code-snippets
43 lines (43 loc) · 1.25 KB
/
purplet.code-snippets
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
{
"Structure Class": {
"prefix": "struct",
"body": [
"import type { Immutable } from '@paperdave/utils';",
"/** Structure for $2 */",
"export class $1 {",
" constructor(readonly raw: Immutable<$2>) {}",
"",
" get id() {",
" return this.raw.id;",
" }",
"",
" $0",
"}"
],
"description": "Structure Class"
},
"Partial Structure": {
"prefix": "partial",
"description": "",
"body": [
"import { type PartialClass, createPartialClass } from '../utils/partial';",
"export type $1Partial = PartialClass<",
" // Class, Required properties from `raw`, Allowed methods from class",
" typeof $1,",
" 'id',",
" 'id' | 'fetch'",
">;",
"export const $1Partial = createPartialClass<$1Partial>($1);"
],
"scope": "typescript"
},
"BitField template": {
"prefix": "template_bitfield",
"body": [
"export const $1Bitfield = createBitfieldClass<typeof $1>('$1Bitfield', $1);",
"export const Readonly$1Bitfield = createReadonlyBitfield($1Bitfield);",
"export type $1BitField = InstanceType<typeof $1Bitfield>;",
"export type Readonly$1BitField = InstanceType<typeof Readonly$1Bitfield>;"
]
}
}