Skip to content
This repository has been archived by the owner on Feb 8, 2024. It is now read-only.

Prefer as const with TypeScript 4.9 introduced satisfies #415

Merged
merged 6 commits into from Nov 24, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/ci-official.yml
Expand Up @@ -41,7 +41,8 @@ jobs:
with:
node-version: '${{ fromJson(needs.asdf-parser.outputs.tool-versions).nodejs }}'
cache: npm
- run: npm ci # `--ignore-scripts` do not cover RE2
# TODO: Revert `--legacy-peer-deps` after typescript-eslint released 5.44.1 or later. See https://github.com/kachick/renovate-config-asdf/pull/415
- run: npm ci --legacy-peer-deps # `--ignore-scripts` do not cover RE2
# renovate.json will always tested by the CLI
- run: RENOVATE_CONFIG_FILE=default.json npx renovate-config-validator
- run: RENOVATE_CONFIG_FILE=self.json npx renovate-config-validator
3 changes: 2 additions & 1 deletion .github/workflows/ci-typescript.yml
Expand Up @@ -38,7 +38,8 @@ jobs:
with:
node-version: '${{ fromJson(needs.asdf-parser.outputs.tool-versions).nodejs }}'
cache: npm
- run: npm ci
# TODO: Revert `--legacy-peer-deps` after typescript-eslint released 5.44.1 or later. See https://github.com/kachick/renovate-config-asdf/pull/415
- run: npm ci --legacy-peer-deps
- run: npx tsc
- run: make eslint-check
- run: npx ts-node-test test/*.ts
1 change: 1 addition & 0 deletions .vscode/settings.json
@@ -1,4 +1,5 @@
{
"typescript.tsdk": "node_modules/typescript/lib",
"editor.defaultFormatter": "dprint.dprint",
"editor.formatOnSave": true,
"cSpell.words": [
Expand Down
348 changes: 170 additions & 178 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -2,8 +2,8 @@
"devDependencies": {
"@tsconfig/node18-strictest-esm": "^1.0.1",
"@types/node": "^18.11.9",
"@typescript-eslint/eslint-plugin": "^5.44.0",
"@typescript-eslint/parser": "^5.44.0",
"@typescript-eslint/eslint-plugin": "^5.44.1-alpha.6",
"@typescript-eslint/parser": "^5.44.1-alpha.6",
"eslint": "^8.28.0",
"eslint-plugin-deprecation": "^1.3.3",
"eslint-plugin-import": "^2.26.0",
Expand Down
4 changes: 2 additions & 2 deletions test/examples.ts
Expand Up @@ -4,7 +4,7 @@ interface Example {
extracted: string;
}

export const examples: Readonly<Readonly<Example>[]> = [
export const examples = [
{
plugin: 'bun',
source: 'bun-v0.1.11',
Expand Down Expand Up @@ -131,4 +131,4 @@ export const examples: Readonly<Readonly<Example>[]> = [
source: 'v0.31.3',
extracted: '0.31.3',
},
];
] as const satisfies Readonly<Readonly<Example>[]>;
3 changes: 2 additions & 1 deletion test/regex_test.ts
Expand Up @@ -31,7 +31,8 @@ interface RegExManager extends RegexManagerTemplates {
}

void test('extractVersionTemplate', async (t) => {
const plugins = new Set(examples.map((example) => example.plugin));
// https://github.com/microsoft/TypeScript/issues/14520#issuecomment-853946018 :<
const plugins = new Set(examples.map((example) => example.plugin as string));

for (const basename of fs.readdirSync('plugins')) {
const pluginPath = path.join('plugins', basename);
Expand Down