mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-24 11:26:31 +00:00
Fix typecheck in API 0.165.0 (#4069)
This commit is contained in:
@@ -7,8 +7,8 @@
|
||||
"devDependencies": {
|
||||
"@biomejs/biome": "^1.9.4",
|
||||
"@changesets/cli": "^2.29.8",
|
||||
"turbo": "^2.8.6",
|
||||
"vercel": "^50.15.1",
|
||||
"turbo": "^2.8.10",
|
||||
"vercel": "^50.23.2",
|
||||
},
|
||||
},
|
||||
"packages/browser-types": {
|
||||
@@ -347,7 +347,7 @@
|
||||
"react-dom": "catalog:",
|
||||
},
|
||||
"catalog": {
|
||||
"@gitbook/api": "0.164.0",
|
||||
"@gitbook/api": "0.165.0",
|
||||
"@scalar/api-client-react": "^1.3.46",
|
||||
"@tsconfig/node20": "^20.1.6",
|
||||
"@tsconfig/strictest": "^2.0.6",
|
||||
@@ -744,7 +744,7 @@
|
||||
|
||||
"@fortawesome/fontawesome-svg-core": ["@fortawesome/fontawesome-svg-core@7.1.0", "", { "dependencies": { "@fortawesome/fontawesome-common-types": "7.1.0" } }, "sha512-fNxRUk1KhjSbnbuBxlWSnBLKLBNun52ZBTcs22H/xEEzM6Ap81ZFTQ4bZBxVQGQgVY0xugKGoRcCbaKjLQ3XZA=="],
|
||||
|
||||
"@gitbook/api": ["@gitbook/api@0.164.0", "", { "dependencies": { "event-iterator": "^2.0.0", "eventsource-parser": "^3.0.0" } }, "sha512-u0npCEK253qSbn118YMMi1E5dqrLQnBlXnovXOpbzQP8BF62ktrndnhtH8AhTvV4ld9UHDKjCaxxidmtuYoU9g=="],
|
||||
"@gitbook/api": ["@gitbook/api@0.165.0", "", { "dependencies": { "event-iterator": "^2.0.0", "eventsource-parser": "^3.0.0" } }, "sha512-FzdaQUrG/XEMuUiYUPold/xPKMOYQt/wBJXK+ChQh1B10KHoQOdDPezmK56WZewNHeFHcErOERcNfgQ5MdZsfQ=="],
|
||||
|
||||
"@gitbook/browser-types": ["@gitbook/browser-types@workspace:packages/browser-types"],
|
||||
|
||||
|
||||
+1
-1
@@ -41,7 +41,7 @@
|
||||
"catalog": {
|
||||
"@tsconfig/strictest": "^2.0.6",
|
||||
"@tsconfig/node20": "^20.1.6",
|
||||
"@gitbook/api": "0.164.0",
|
||||
"@gitbook/api": "0.165.0",
|
||||
"@scalar/api-client-react": "^1.3.46",
|
||||
"@types/react": "^19.0.0",
|
||||
"@types/react-dom": "^19.0.0",
|
||||
|
||||
@@ -30,6 +30,7 @@ import { getGitBookAppHref } from './app';
|
||||
import { getBlockById, getBlockTitle } from './document';
|
||||
import { resolvePageId } from './pages';
|
||||
import { findSiteSpaceBy, getFallbackSiteSpacePath } from './sites';
|
||||
import { getRevisionTags, resolveTag } from './tags';
|
||||
import type { ClassValue } from './tailwind';
|
||||
import { filterOutNullable } from './typescript';
|
||||
|
||||
@@ -346,6 +347,24 @@ export async function resolveContentRef(
|
||||
};
|
||||
}
|
||||
|
||||
case 'tag': {
|
||||
if (isContentRefInDifferentSpace(contentRef, context)) {
|
||||
return resolveContentRefInSpace(contentRef.space, context, contentRef, options);
|
||||
}
|
||||
|
||||
const tag = resolveTag(contentRef.tag, getRevisionTags(revision));
|
||||
if (!tag) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return {
|
||||
href: linker.toPathInSpace(''),
|
||||
text: tag.label,
|
||||
active: false,
|
||||
space,
|
||||
};
|
||||
}
|
||||
|
||||
default:
|
||||
assertNever(contentRef);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user