import{_ as o}from"./chunks/PageInfo.vue_vue_type_script_setup_true_lang.250b3e56.js";import{_ as a,o as n,c as t,H as c,k as s,a as l,Q as r}from"./chunks/framework.b7580407.js";import"./chunks/commonjsHelpers.725317a4.js";const B=JSON.parse('{"title":"Queries","description":"One of the key features of Twoslash is the ability to use the TypeScript compiler to pull out type information about your code.","frontmatter":{"description":"One of the key features of Twoslash is the ability to use the TypeScript compiler to pull out type information about your code.","title":"Queries"},"headers":[],"relativePath":"application/vitepress-plugin-shiki-twoslash/api/queries.md","filePath":"application/vitepress-plugin-shiki-twoslash/api/queries.md","lastUpdated":1710267506000}'),i={name:"application/vitepress-plugin-shiki-twoslash/api/queries.md"},p=s("h1",{id:"queries",tabindex:"-1"},[l("Queries "),s("a",{class:"header-anchor",href:"#queries","aria-label":'Permalink to "Queries"'},"​")],-1),d=r('<p>One of the key features of Twoslash is the ability to use the TypeScript compiler to pull out type information about your code. Twoslash comes with two different ways to query your code: <code>?^</code> and <code>?|</code>.</p><h2 id="extract-type" tabindex="-1">Extract Type <code>^?</code> <a class="header-anchor" href="#extract-type" aria-label="Permalink to &quot;Extract Type `^?`&quot;">​</a></h2><p>Using <code>^?</code> you can pull out type information about a particular identifier in the line of code above it.</p>',3),u=s("div",{class:"vp-code-group vp-adaptive-theme"},[s("div",{class:"tabs"},[s("input",{type:"radio",name:"group-yoPdC",id:"tab-vVEvOfg",checked:"checked"}),s("label",{for:"tab-vVEvOfg"},"output"),s("input",{type:"radio",name:"group-yoPdC",id:"tab-eXDfgPg"}),s("label",{for:"tab-eXDfgPg"},"markdown")]),s("div",{class:"blocks"},[s("div",{class:"language-ts vp-adaptive-theme active line-numbers-mode"},[s("button",{title:"Copy Code",class:"copy"}),s("span",{class:"lang"},"ts"),s("pre",{class:"shiki github-dark-dimmed twoslash lsp",style:{"background-color":"#22272e",color:"#adbac7"}},[s("div",{class:"language-id"},"ts"),s("div",{class:"code-container"},[s("code",null,[s("div",{class:"line"},[s("span",{style:{color:"#F47067"}},"const"),s("span",{style:{color:"#ADBAC7"}}," "),s("span",{style:{color:"#6CB6FF"}},[s("data-lsp",{lsp:'const hi: "Hello"'},"hi")]),s("span",{style:{color:"#ADBAC7"}}," "),s("span",{style:{color:"#F47067"}},"="),s("span",{style:{color:"#ADBAC7"}}," "),s("span",{style:{color:"#96D0FF"}},"'Hello'")]),s("div",{class:"line"},[s("span",{style:{color:"#F47067"}},"const"),s("span",{style:{color:"#ADBAC7"}}," "),s("span",{style:{color:"#6CB6FF"}},[s("data-lsp",{lsp:"const msg: string",style:{"border-bottom":"solid 2px lightgrey"}},"msg")]),s("span",{style:{color:"#ADBAC7"}}," "),s("span",{style:{color:"#F47067"}},"="),s("span",{style:{color:"#ADBAC7"}},[l(),s("data-lsp",{lsp:'const hi: "Hello"'},"hi"),l()]),s("span",{style:{color:"#F47067"}},"+"),s("span",{style:{color:"#ADBAC7"}}," "),s("span",{style:{color:"#96D0FF"}},"', world'")]),s("div",{class:"meta-line"},[s("span",{class:"popover-prefix"},"      "),s("span",{class:"popover"},[s("div",{class:"arrow"}),l("const msg: string")])])])])]),s("pre",{class:"shiki github-light twoslash lsp",style:{"background-color":"#fff",color:"#24292e"}},[s("div",{class:"language-id"},"ts"),s("div",{class:"code-container"},[s("code",null,[s("div",{class:"line"},[s("span",{style:{color:"#D73A49"}},"const"),s("span",{style:{color:"#24292E"}}," "),s("span",{style:{color:"#005CC5"}},[s("data-lsp",{lsp:'const hi: "Hello"'},"hi")]),s("span",{style:{color:"#24292E"}}," "),s("span",{style:{color:"#D73A49"}},"="),s("span",{style:{color:"#24292E"}}," "),s("span",{style:{color:"#032F62"}},"'Hello'")]),s("div",{class:"line"},[s("span",{style:{color:"#D73A49"}},"const"),s("span",{style:{color:"#24292E"}}," "),s("span",{style:{color:"#005CC5"}},[s("data-lsp",{lsp:"const msg: string",style:{"border-bottom":"solid 2px lightgrey"}},"msg")]),s("span",{style:{color:"#24292E"}}," "),s("span",{style:{color:"#D73A49"}},"="),s("span",{style:{color:"#24292E"}},[l(),s("data-lsp",{lsp:'const hi: "Hello"'},"hi"),l()]),s("span",{style:{color:"#D73A49"}},"+"),s("span",{style:{color:"#24292E"}}," "),s("span",{style:{color:"#032F62"}},"', world'")]),s("div",{class:"meta-line"},[s("span",{class:"popover-prefix"},"      "),s("span",{class:"popover"},[s("div",{class:"arrow"}),l("const msg: string")])])])])]),s("div",{class:"line-numbers-wrapper","aria-hidden":"true"},[s("span",{class:"line-number"},"1"),s("br")])]),s("div",{class:"language-md vp-adaptive-theme line-numbers-mode"},[s("button",{title:"Copy Code",class:"copy"}),s("span",{class:"lang"},"md"),s("pre",{class:"shiki github-dark-dimmed vp-code-dark"},[s("code",null,[s("span",{class:"line"},[s("span",{style:{color:"#ADBAC7"}},"```ts twoslash")]),l(`
`),s("span",{class:"line"},[s("span",{style:{color:"#F47067"}},"const"),s("span",{style:{color:"#ADBAC7"}}," "),s("span",{style:{color:"#6CB6FF"}},"hi"),s("span",{style:{color:"#ADBAC7"}}," "),s("span",{style:{color:"#F47067"}},"="),s("span",{style:{color:"#ADBAC7"}}," "),s("span",{style:{color:"#96D0FF"}},"'Hello'")]),l(`
`),s("span",{class:"line"},[s("span",{style:{color:"#F47067"}},"const"),s("span",{style:{color:"#ADBAC7"}}," "),s("span",{style:{color:"#6CB6FF"}},"msg"),s("span",{style:{color:"#ADBAC7"}}," "),s("span",{style:{color:"#F47067"}},"="),s("span",{style:{color:"#ADBAC7"}}," hi "),s("span",{style:{color:"#F47067"}},"+"),s("span",{style:{color:"#ADBAC7"}}," "),s("span",{style:{color:"#96D0FF"}},"', world'")]),l(`
`),s("span",{class:"line"},[s("span",{style:{color:"#768390"}},"//    ^?")]),l(`
`),s("span",{class:"line"},[s("span",{style:{color:"#ADBAC7"}},"```")])])]),s("pre",{class:"shiki github-light vp-code-light"},[s("code",null,[s("span",{class:"line"},[s("span",{style:{color:"#24292E"}},"```ts twoslash")]),l(`
`),s("span",{class:"line"},[s("span",{style:{color:"#D73A49"}},"const"),s("span",{style:{color:"#24292E"}}," "),s("span",{style:{color:"#005CC5"}},"hi"),s("span",{style:{color:"#24292E"}}," "),s("span",{style:{color:"#D73A49"}},"="),s("span",{style:{color:"#24292E"}}," "),s("span",{style:{color:"#032F62"}},"'Hello'")]),l(`
`),s("span",{class:"line"},[s("span",{style:{color:"#D73A49"}},"const"),s("span",{style:{color:"#24292E"}}," "),s("span",{style:{color:"#005CC5"}},"msg"),s("span",{style:{color:"#24292E"}}," "),s("span",{style:{color:"#D73A49"}},"="),s("span",{style:{color:"#24292E"}}," hi "),s("span",{style:{color:"#D73A49"}},"+"),s("span",{style:{color:"#24292E"}}," "),s("span",{style:{color:"#032F62"}},"', world'")]),l(`
`),s("span",{class:"line"},[s("span",{style:{color:"#6A737D"}},"//    ^?")]),l(`
`),s("span",{class:"line"},[s("span",{style:{color:"#24292E"}},"```")])])]),s("div",{class:"line-numbers-wrapper","aria-hidden":"true"},[s("span",{class:"line-number"},"1"),s("br"),s("span",{class:"line-number"},"2"),s("br"),s("span",{class:"line-number"},"3"),s("br"),s("span",{class:"line-number"},"4"),s("br"),s("span",{class:"line-number"},"5"),s("br")])])])],-1),y=s("h2",{id:"completions",tabindex:"-1"},[l("Completions "),s("code",null,"^|"),l(),s("a",{class:"header-anchor",href:"#completions","aria-label":'Permalink to "Completions `^|`"'},"​")],-1),h=s("p",null,[l("Using "),s("code",null,"^|"),l(" you can pull out information about a what the auto-complete looks like at a particular location.")],-1),m=s("div",{class:"vp-code-group vp-adaptive-theme"},[s("div",{class:"tabs"},[s("input",{type:"radio",name:"group-4k2k6",id:"tab-SaKB4ka",checked:"checked"}),s("label",{for:"tab-SaKB4ka"},"output"),s("input",{type:"radio",name:"group-4k2k6",id:"tab-OVNG_ep"}),s("label",{for:"tab-OVNG_ep"},"markdown")]),s("div",{class:"blocks"},[s("div",{class:"language-ts vp-adaptive-theme active line-numbers-mode"},[s("button",{title:"Copy Code",class:"copy"}),s("span",{class:"lang"},"ts"),s("pre",{class:"shiki github-dark-dimmed twoslash lsp",style:{"background-color":"#22272e",color:"#adbac7"}},[s("div",{class:"language-id"},"ts"),s("div",{class:"code-container"},[s("code",null,[s("div",{class:"line"},[s("span",{style:{color:"#ADBAC7"}},[s("data-lsp",{lsp:"var console: Console"},"console"),l("."),s("data-lsp",{lsp:"any"},"e")])]),s("div",{class:"meta-line"},[l("         "),s("span",{class:"inline-completions"},[s("ul",{class:"dropdown"},[s("li",{class:""},[s("span",null,[s("span",{class:"result-found"},"e"),l("rror")])])])])])])])]),s("pre",{class:"shiki github-light twoslash lsp",style:{"background-color":"#fff",color:"#24292e"}},[s("div",{class:"language-id"},"ts"),s("div",{class:"code-container"},[s("code",null,[s("div",{class:"line"},[s("span",{style:{color:"#24292E"}},[s("data-lsp",{lsp:"var console: Console"},"console"),l("."),s("data-lsp",{lsp:"any"},"e")])]),s("div",{class:"meta-line"},[l("         "),s("span",{class:"inline-completions"},[s("ul",{class:"dropdown"},[s("li",{class:""},[s("span",null,[s("span",{class:"result-found"},"e"),l("rror")])])])])])])])]),s("div",{class:"line-numbers-wrapper","aria-hidden":"true"},[s("span",{class:"line-number"},"1"),s("br")])]),s("div",{class:"language-md vp-adaptive-theme line-numbers-mode"},[s("button",{title:"Copy Code",class:"copy"}),s("span",{class:"lang"},"md"),s("pre",{class:"shiki github-dark-dimmed vp-code-dark"},[s("code",null,[s("span",{class:"line"},[s("span",{style:{color:"#ADBAC7"}},"```ts twoslash")]),l(`
`),s("span",{class:"line"},[s("span",{style:{color:"#768390"}},"// @noErrors")]),l(`
`),s("span",{class:"line"},[s("span",{style:{color:"#ADBAC7"}},"console.e")]),l(`
`),s("span",{class:"line"},[s("span",{style:{color:"#768390"}},"//       ^|")]),l(`
`),s("span",{class:"line"},[s("span",{style:{color:"#ADBAC7"}},"```")])])]),s("pre",{class:"shiki github-light vp-code-light"},[s("code",null,[s("span",{class:"line"},[s("span",{style:{color:"#24292E"}},"```ts twoslash")]),l(`
`),s("span",{class:"line"},[s("span",{style:{color:"#6A737D"}},"// @noErrors")]),l(`
`),s("span",{class:"line"},[s("span",{style:{color:"#24292E"}},"console.e")]),l(`
`),s("span",{class:"line"},[s("span",{style:{color:"#6A737D"}},"//       ^|")]),l(`
`),s("span",{class:"line"},[s("span",{style:{color:"#24292E"}},"```")])])]),s("div",{class:"line-numbers-wrapper","aria-hidden":"true"},[s("span",{class:"line-number"},"1"),s("br"),s("span",{class:"line-number"},"2"),s("br"),s("span",{class:"line-number"},"3"),s("br"),s("span",{class:"line-number"},"4"),s("br"),s("span",{class:"line-number"},"5"),s("br")])])])],-1),b=s("div",{class:"info custom-block"},[s("p",{class:"custom-block-title"},"INFO"),s("p",null,[l("Note that the compiler flag for "),s("a",{href:"./errors#noerrors"},[s("code",null,"// @noErrors")]),l(" is set, because "),s("code",null,"console.e"),l(" is a failing TypeScript code sample but we don't really care about that.")])],-1);function g(v,A,f,k,C,_){const e=o;return n(),t("div",null,[p,c(e,{readTime:"1",words:"167"}),d,u,y,h,m,b])}const E=a(i,[["render",g]]);export{B as __pageData,E as default};
