Skip to content

Commit 04947ff

Browse files
committed
fix: update types
1 parent dfe43bb commit 04947ff

File tree

7 files changed

+901
-852
lines changed

7 files changed

+901
-852
lines changed

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,15 @@
4646
},
4747
"devDependencies": {
4848
"@nuxt/eslint-config": "^0.2.0",
49-
"@nuxt/kit": "^3.10.3",
49+
"@nuxt/kit": "^3.11.1",
5050
"@nuxtjs/eslint-config-typescript": "latest",
5151
"@types/flat": "^5.0.5",
5252
"@types/js-yaml": "^4.0.9",
53-
"@types/node": "^20.11.24",
53+
"@types/node": "^20.11.30",
5454
"eslint": "^8.57.0",
5555
"eslint-plugin-nuxt": "latest",
5656
"jiti": "^1.21.0",
57-
"nuxt": "^3.10.3",
57+
"nuxt": "^3.11.1",
5858
"release-it": "^17.1.1",
5959
"remark-gfm": "^4.0.0",
6060
"remark-parse": "^11.0.0",

playground/composables/useMarkdownGenerator.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import type { Root, Node } from 'mdast'
2+
import type { Processor } from 'unified'
13
import type { Ref } from 'vue'
24

35
// workaround for kleur
@@ -9,7 +11,7 @@ function jsonParser (this: any) {
911
}
1012
}
1113
export function useMarkdownGenerator (input: Ref<object>, mdcOptions = ref({})) {
12-
let _stream
14+
let _stream: Processor<undefined, Node, Node, Root, string> | null = null
1315
const markdown = ref('')
1416
const generate = async (ast: object) => {
1517
if (!_stream) {
@@ -26,7 +28,7 @@ export function useMarkdownGenerator (input: Ref<object>, mdcOptions = ref({}))
2628
bullet: '-'
2729
})
2830
}
29-
const res = await _stream.process(JSON.stringify(ast)).then(file => file.value)
31+
const res = await _stream.process(JSON.stringify(ast)).then(file => file.value as string)
3032
markdown.value = res
3133
}
3234

playground/composables/useMarkdownParser.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import type { Preset } from 'unified'
1+
import type { Root, Node } from 'mdast'
2+
import type { Preset, Processor } from 'unified'
23
import type { Ref } from 'vue'
34

45
// workaround for kleur
@@ -11,8 +12,8 @@ function compiler (this: any) {
1112
}
1213

1314
export function useMarkdownParser (input: Ref<string>, mdcOptions = ref({})) {
14-
let _stream
15-
const ast = ref(null)
15+
let _stream: Processor<Root, Node, Node, undefined, undefined> | null = null
16+
const ast = ref()
1617
const parse = async (str: string) => {
1718
if (!_stream) {
1819
const unified = await import('unified').then(r => r.unified)

0 commit comments

Comments
 (0)