diff --git a/packages/gatsby-remark-shiki/test/fixtures/twoliner.md b/packages/gatsby-remark-shiki/test/fixtures/twoliner.md index 6a142dec85e7..c60ea2667821 100644 --- a/packages/gatsby-remark-shiki/test/fixtures/twoliner.md +++ b/packages/gatsby-remark-shiki/test/fixtures/twoliner.md @@ -4,6 +4,6 @@ // @filename: getStringLength.ts export const getStringLength = (str: string) => str.length // @filename: index.ts -import {getStringLength} from "./getStringLength" -const b = getStringLength("string) +import { getStringLength } from './getStringLength' +const b = getStringLength('string') ``` diff --git a/packages/gatsby-remark-shiki/test/results/one.html b/packages/gatsby-remark-shiki/test/results/one.html index 97451cd92ce4..f3606a778fd0 100644 --- a/packages/gatsby-remark-shiki/test/results/one.html +++ b/packages/gatsby-remark-shiki/test/results/one.html @@ -9,10 +9,10 @@
+ -ts// @filename: getStringLength.ts +export const getStringLength = (str: string) => str.length +// @filename: index.ts +import { getStringLength } from './getStringLength' +const b = getStringLength('string')
diff --git a/packages/gatsby-remark-shiki/test/results/twoliner.json b/packages/gatsby-remark-shiki/test/results/twoliner.json index 5253d36afd6b..0e6e9850e6f5 100644 --- a/packages/gatsby-remark-shiki/test/results/twoliner.json +++ b/packages/gatsby-remark-shiki/test/results/twoliner.json @@ -1,66 +1,75 @@ [ { - "code": "const getStringLength = (str: string) => str.length\nconst exports = {\n getStringLength,\n}", + "code": "// @filename: getStringLength.ts\nexport const getStringLength = (str: string) => str.length\n// @filename: index.ts\nimport { getStringLength } from './getStringLength'\nconst b = getStringLength('string')", "extension": "ts", "highlights": [], "queries": [], "staticQuickInfos": [ + { + "text": "(alias) const getStringLength: (str: string) => number\nimport getStringLength", + "docs": "", + "start": 124, + "length": 15, + "line": 1, + "character": 72, + "targetString": "getStringLength" + }, + { + "text": "const b: number", + "docs": "", + "start": 173, + "length": 1, + "line": 1, + "character": 121, + "targetString": "b" + }, + { + "text": "(alias) getStringLength(str: string): number\nimport getStringLength", + "docs": "", + "start": 177, + "length": 15, + "line": 1, + "character": 125, + "targetString": "getStringLength" + }, { "text": "const getStringLength: (str: string) => number", "docs": "", - "start": 6, + "start": 46, "length": 15, "line": 0, - "character": 6, + "character": 46, "targetString": "getStringLength" }, { "text": "(parameter) str: string", "docs": "", - "start": 25, + "start": 65, "length": 3, - "line": 0, - "character": 25, + "line": 1, + "character": 6, "targetString": "str" }, { "text": "(parameter) str: string", "docs": "", - "start": 41, + "start": 81, "length": 3, - "line": 0, - "character": 41, + "line": 1, + "character": 22, "targetString": "str" }, { "text": "(property) String.length: number", "docs": "Returns the length of a String object.", - "start": 45, + "start": 85, "length": 6, - "line": 0, - "character": 45, - "targetString": "length" - }, - { - "text": "const exports: {\n getStringLength: (str: string) => number;\n}", - "docs": "", - "start": 58, - "length": 7, "line": 1, - "character": 6, - "targetString": "exports" - }, - { - "text": "(property) getStringLength: (str: string) => number", - "docs": "", - "start": 72, - "length": 15, - "line": 2, - "character": 2, - "targetString": "getStringLength" + "character": 26, + "targetString": "length" } ], "errors": [], - "playgroundURL": "https://www.typescriptlang.org/play/#code/MYewdgzgLgBA5gUygZSgJwJZjgGQdqACxgF4YAKaNALhiqzgEpSA+O9AOgBt84iAoUJFgIAHgAcQaKBFIwA3vxjwkqTNjwFCAGn4BfIA" + "playgroundURL": "https://www.typescriptlang.org/play/#code/PTAEAEDMEsBsFMB2BDAtvAXKA5vALgMp4BO0i2AMktngBYB0eAzgFDwAeADgPbF6gBjboib9chEmUrU6oALygAFKOJYVUgJTyAfKBX0E5OixAQYhtJlBkAJh0atoqHn1ABvHPiKlyVI7VAAX1BIYm5UUAByemBxbyk-GlpIliERfgAjeU8JH2l-RUj1ckiNIA" } ]tsconst getStringLengthconst getStringLength: (str: string) => number = (str(parameter) str: string: string) => str(parameter) str: string.length(property) String.length: number -const exportsconst exports: { getStringLength: (str: string) => number; } = { - getStringLength(property) getStringLength: (str: string) => number, -}