diff --git a/src/api/global-api.md b/src/api/global-api.md index 7a6c7ed681..b5b7582fc6 100644 --- a/src/api/global-api.md +++ b/src/api/global-api.md @@ -403,7 +403,7 @@ For example, for runtime-dom, HostNode would be the DOM Custom renderers can pass in the platform specific types like this: -```js +```ts import { createRenderer } from 'vue' const { render, createApp } = createRenderer({ patchProp, diff --git a/src/api/refs-api.md b/src/api/refs-api.md index 766e7550fd..b87fd8f215 100644 --- a/src/api/refs-api.md +++ b/src/api/refs-api.md @@ -38,7 +38,7 @@ foo.value = 123 // ok! If the type of the generic is unknown, it's recommended to cast `ref` to `Ref`: -```js +```ts function useState(initial: State) { const state = ref(initial) as Ref // state.value -> State extends string return state @@ -49,7 +49,7 @@ function useState(initial: State) { Returns the inner value if the argument is a [`ref`](#ref), otherwise return the argument itself. This is a sugar function for `val = isRef(val) ? val.value : val`. -```js +```ts function useFoo(x: number | Ref) { const unwrapped = unref(x) // unwrapped is guaranteed to be number now } diff --git a/src/cookbook/debugging-in-vscode.md b/src/cookbook/debugging-in-vscode.md index 8327d72165..842656e699 100644 --- a/src/cookbook/debugging-in-vscode.md +++ b/src/cookbook/debugging-in-vscode.md @@ -102,7 +102,7 @@ Please note that if the page uses a production/minified build of Vue.js (such as The example above has a great workflow. However, there is an alternative option where you can use the [native debugger statement](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/debugger) directly in your code. If you choose to work this way, it's important that you remember to remove the statements when you're done. -```js +```vue