Skip to content

Commit b09d71c

Browse files
authored
Convert tools directory JavaScript files to TypeScript (#55552)
1 parent 4f3be99 commit b09d71c

File tree

7 files changed

+26
-10
lines changed

7 files changed

+26
-10
lines changed

src/content-render/liquid/tool.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { allTools } from '#src/tools/lib/all-tools.js'
2-
import { allPlatforms } from '#src/tools/lib/all-platforms.js'
1+
import { allTools } from '#src/tools/lib/all-tools.ts'
2+
import { allPlatforms } from '#src/tools/lib/all-platforms.ts'
33

44
export const tags = Object.keys(allTools).concat(allPlatforms).concat(['rowheaders'])
55

src/frame/lib/frontmatter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import parse from './read-frontmatter.js'
22
import { allVersions } from '#src/versions/lib/all-versions.js'
3-
import { allTools } from '#src/tools/lib/all-tools.js'
3+
import { allTools } from '#src/tools/lib/all-tools.ts'
44
import { getDeepDataByLanguage } from '#src/data-directory/lib/get-data.js'
55

66
const layoutNames = [

src/frame/lib/page.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ import slash from 'slash'
1414
import readFileContents from './read-file-contents.js'
1515
import getLinkData from '#src/learning-track/lib/get-link-data.js'
1616
import getDocumentType from '#src/events/lib/get-document-type.ts'
17-
import { allTools } from '#src/tools/lib/all-tools.js'
17+
import { allTools } from '#src/tools/lib/all-tools.ts'
1818
import { renderContentWithFallback } from '#src/languages/lib/render-with-fallback.js'
1919
import { deprecated, supported } from '#src/versions/lib/enterprise-server-releases.js'
20-
import { allPlatforms } from '#src/tools/lib/all-platforms.js'
20+
import { allPlatforms } from '#src/tools/lib/all-platforms.ts'
2121

2222
// We're going to check a lot of pages' "ID" (the first part of
2323
// the relativePath) against `productMap` to make sure it's valid.

src/shielding/middleware/handle-invalid-query-string-values.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const STATSD_KEY = 'middleware.handle_invalid_querystring_values'
1919
// that the values of `?platform=...` should be none when the path is
2020
// something like `/en/search`.
2121
const RECOGNIZED_VALUES = {
22-
platform: allPlatforms,
22+
platform: allPlatforms as string[],
2323
tool: Object.keys(allTools),
2424
}
2525
// So we can look up if a key in the object is actually present

src/tools/lib/all-platforms.js

Lines changed: 0 additions & 2 deletions
This file was deleted.

src/tools/lib/all-platforms.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/**
2+
* All platforms available for the Platform Picker
3+
*/
4+
export type Platform = 'mac' | 'windows' | 'linux'
5+
6+
/**
7+
* Array of all supported platforms in the Platform Picker
8+
*/
9+
export const allPlatforms: Platform[] = ['mac', 'windows', 'linux']

src/tools/lib/all-tools.js renamed to src/tools/lib/all-tools.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
1-
// all the tools available for the Tool Picker
2-
export const allTools = {
1+
/**
2+
* Interface defining the mapping between tool identifiers and their display names
3+
*/
4+
export interface ToolsMapping {
5+
[key: string]: string
6+
}
7+
8+
/**
9+
* All the tools available for the Tool Picker
10+
*/
11+
export const allTools: ToolsMapping = {
312
agents: 'Agents',
413
api: 'API',
514
azure_data_studio: 'Azure Data Studio',

0 commit comments

Comments
 (0)