Skip to content

Commit

Permalink
fix: update types
Browse files Browse the repository at this point in the history
  • Loading branch information
farnabaz committed Mar 21, 2024
1 parent dfe43bb commit 04947ff
Show file tree
Hide file tree
Showing 7 changed files with 901 additions and 852 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@
},
"devDependencies": {
"@nuxt/eslint-config": "^0.2.0",
"@nuxt/kit": "^3.10.3",
"@nuxt/kit": "^3.11.1",
"@nuxtjs/eslint-config-typescript": "latest",
"@types/flat": "^5.0.5",
"@types/js-yaml": "^4.0.9",
"@types/node": "^20.11.24",
"@types/node": "^20.11.30",
"eslint": "^8.57.0",
"eslint-plugin-nuxt": "latest",
"jiti": "^1.21.0",
"nuxt": "^3.10.3",
"nuxt": "^3.11.1",
"release-it": "^17.1.1",
"remark-gfm": "^4.0.0",
"remark-parse": "^11.0.0",
Expand Down
6 changes: 4 additions & 2 deletions playground/composables/useMarkdownGenerator.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import type { Root, Node } from 'mdast'
import type { Processor } from 'unified'
import type { Ref } from 'vue'

// workaround for kleur
Expand All @@ -9,7 +11,7 @@ function jsonParser (this: any) {
}
}
export function useMarkdownGenerator (input: Ref<object>, mdcOptions = ref({})) {
let _stream
let _stream: Processor<undefined, Node, Node, Root, string> | null = null
const markdown = ref('')
const generate = async (ast: object) => {
if (!_stream) {
Expand All @@ -26,7 +28,7 @@ export function useMarkdownGenerator (input: Ref<object>, mdcOptions = ref({}))
bullet: '-'
})
}
const res = await _stream.process(JSON.stringify(ast)).then(file => file.value)
const res = await _stream.process(JSON.stringify(ast)).then(file => file.value as string)
markdown.value = res
}

Expand Down
7 changes: 4 additions & 3 deletions playground/composables/useMarkdownParser.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { Preset } from 'unified'
import type { Root, Node } from 'mdast'
import type { Preset, Processor } from 'unified'
import type { Ref } from 'vue'

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

export function useMarkdownParser (input: Ref<string>, mdcOptions = ref({})) {
let _stream
const ast = ref(null)
let _stream: Processor<Root, Node, Node, undefined, undefined> | null = null
const ast = ref()
const parse = async (str: string) => {
if (!_stream) {
const unified = await import('unified').then(r => r.unified)
Expand Down
Loading

0 comments on commit 04947ff

Please sign in to comment.