Skip to content

Commit

Permalink
Update TypeScript code example
Browse files Browse the repository at this point in the history
  • Loading branch information
fasttime committed Aug 11, 2024
1 parent aa649dc commit 4d56ec4
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 30 deletions.
12 changes: 7 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
name: CI
name: Node.js CI

on: [push, pull_request]
on:
push:
branches: '**'
tags-ignore: '**'
pull_request:
branches: '**'

jobs:

build:

env:
TSESTREE_SINGLE_RUN: 'false'

name: Build

runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion example/ColoredCircle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ console.log(ColoredCircle.isPrototypeOf(ColoredCircle)); // false
console.log(Object.isPrototypeOf(ColoredCircle)); // false
console.log(Function.prototype.isPrototypeOf(ColoredCircle)); // true

function getBaseNames(derivedClass: Function): string[]
function getBaseNames(derivedClass: new () => unknown): string[]
{
return getPrototypeListOf(derivedClass).map(({ name }: { name: string; }): string => name);
}
Expand Down
41 changes: 18 additions & 23 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,21 +130,21 @@ task
'functions': 'only-multiline',
},
],
'no-unused-vars':
[
'error',
{
args: 'none',
caughtErrors: 'all',
ignoreRestSiblings: true,
vars: 'local',
varsIgnorePattern: '^(?:Green|WhiteUnit)Circle$',
},
],
'@stylistic/quotes': ['error', 'double'],
};
const { 'no-unused-vars': noUnusedVars, ...TS_EXAMPLE_RULES } = JS_EXAMPLE_RULES;
TS_EXAMPLE_RULES['@typescript-eslint/no-unused-vars'] = noUnusedVars;
const TS_EXAMPLE_RULES = { ...JS_EXAMPLE_RULES };
JS_EXAMPLE_RULES['no-unused-vars'] =
TS_EXAMPLE_RULES['@typescript-eslint/no-unused-vars'] =
[
'error',
{
args: 'none',
caughtErrors: 'all',
ignoreRestSiblings: true,
vars: 'local',
varsIgnorePattern: '^(?:Green|WhiteUnit)Circle$',
},
];
const overrideConfig =
await createConfig
(
Expand All @@ -164,13 +164,9 @@ task
jsVersion: 2022,
},
{
files: ['**/*.ts', '**/*.tstest'],
tsVersion: '4.7.0',
languageOptions:
{
parserOptions:
{ extraFileExtensions: ['.tstest'], project: 'tsconfig.json' },
},
files: ['**/*.ts', '**/*.tstest'],
tsVersion: '4.7.0',
languageOptions: { parserOptions: { extraFileExtensions: ['.tstest'] } },
},
{
files: ['example/**/*.js'],
Expand All @@ -183,15 +179,14 @@ task
rules: TS_EXAMPLE_RULES,
},
{
files: ['lib/**/*.d.ts'],
rules: { '@stylistic/max-len': 'off' },
files: ['lib/**/*.d.ts'],
rules: { '@stylistic/max-len': 'off' },
},
{
files: ['**/*.tstest'],
processor: tsTestProcessor,
rules:
{
'@stylistic/spaced-comment': 'off',
'@typescript-eslint/no-extraneous-class': 'off',
'@typescript-eslint/no-misused-new': 'off',
'@typescript-eslint/no-unused-vars': 'off',
Expand Down
2 changes: 1 addition & 1 deletion test/spec/ts-defs/210.tstest
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class B

void
(
(C: typeof A | typeof B): Function =>
(C: typeof A | typeof B): (new () => unknown) =>
class extends classes(C)
{ }
);

0 comments on commit 4d56ec4

Please sign in to comment.