Skip to content

chore: get the TypeScript version range from root package.json #7367

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Aug 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion docs/users/Dependency_Versions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ id: dependency-versions
title: Dependency Versions
---

import packageJson from '../../package.json';

## ESLint

> The version range of ESLint currently supported is `^6.0.0 || ^7.0.0 || ^8.0.0`.
Expand All @@ -16,7 +18,12 @@ Support for specific Current status releases are considered periodically.

## TypeScript

> The version range of TypeScript currently supported is `>=3.3.1 <5.2.0`.
<blockquote>
<p>
The version range of TypeScript currently supported is{' '}
<code>{packageJson.devDependencies.typescript}</code>.
</p>
</blockquote>

Note that we mirror [DefinitelyTyped's version support window](https://github.com/DefinitelyTyped/DefinitelyTyped/#support-window) - meaning we only support versions of TypeScript less than 2 years old.

Expand Down
1 change: 1 addition & 0 deletions packages/website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"react-dom": "^18.2.0",
"react-split-pane": "^0.1.92",
"remark-docusaurus-tabs": "^0.2.0",
"semver": "^7.5.4",
"ts-node": "*",
"typescript": "*"
},
Expand Down
6 changes: 5 additions & 1 deletion packages/website/src/components/editor/useSandboxServices.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { useColorMode } from '@docusaurus/theme-common';
import type * as Monaco from 'monaco-editor';
import { useEffect, useState } from 'react';
import semverSatisfies from 'semver/functions/satisfies';

import rootPackageJson from '../../../../../package.json';
import type { createTypeScriptSandbox } from '../../vendor/sandbox';
import { createCompilerOptions } from '../lib/createCompilerOptions';
import { createFileSystem } from '../linter/bridge';
Expand Down Expand Up @@ -93,7 +95,9 @@ export const useSandboxServices = (
Array.from(
new Set([...sandboxInstance.supportedVersions, window.ts.version]),
)
.filter(item => parseFloat(item) >= 4.3)
.filter(item =>
semverSatisfies(item, rootPackageJson.devDependencies.typescript),
)
.sort((a, b) => b.localeCompare(a)),
);

Expand Down