Skip to content

Commit

Permalink
Update to TypeScript 5.5 and typescript-eslint 8.3.0, start using @st…
Browse files Browse the repository at this point in the history
…ylistic/eslint-plugin, see phetsims/chipper#1451
  • Loading branch information
samreid committed Aug 27, 2024
1 parent 0b24c67 commit ea48154
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion js/Pool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export type TPoolable = {

// Our linter complains that {} should be either Record<string, unknown>, unknown, or Record<string, never>. However in
// this case, we actually want it to be any type of non-nullish structural type, to see if there is anything required.
export type PossiblyRequiredParameterSpread<T> = ( {} extends T ? [ T? ] : [ T ] ); // eslint-disable-line @typescript-eslint/ban-types
export type PossiblyRequiredParameterSpread<T> = ( {} extends T ? [ T? ] : [ T ] ); // eslint-disable-line @typescript-eslint/no-restricted-types

export default class Pool<T extends Constructor> {
private readonly objects: InstanceType<T>[] = [];
Expand Down
4 changes: 2 additions & 2 deletions js/optionize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ type EmptySelfOptionsKeys = keyof EmptySelfOptions;
type OptionizeDefaults<SelfOptions = EmptySelfOptions, ParentOptions = EmptySelfOptions, ProvidedOptions = EmptySelfOptions> =

// Everything optional from SelfOptions must have a default specified
Omit<Required<Options<SelfOptions>>, EmptySelfOptionsKeys> & // eslint-disable-line @typescript-eslint/ban-types
Omit<Required<Options<SelfOptions>>, EmptySelfOptionsKeys> & // eslint-disable-line @typescript-eslint/no-restricted-types

// Anything required in the ProvidedOptions should not show up in the "defaults" object
{ [k in RequiredKeys<ProvidedOptions>]?: never; } &
Expand All @@ -45,7 +45,7 @@ type OptionizeDefaults<SelfOptions = EmptySelfOptions, ParentOptions = EmptySelf
Partial<ParentOptions>

// Include the required properties from ParentOptions that are not in the ProvidedOptions
& Required<Omit<Pick<ParentOptions, RequiredKeys<ParentOptions>>, RequiredKeys<ProvidedOptions>>>; // eslint-disable-line @typescript-eslint/ban-types
& Required<Omit<Pick<ParentOptions, RequiredKeys<ParentOptions>>, RequiredKeys<ProvidedOptions>>>; // eslint-disable-line @typescript-eslint/no-restricted-types

// Factor out the merge arrow closure to avoid heap/cpu at runtime
const merge4 = ( a: IntentionalAny, b?: IntentionalAny, c?: IntentionalAny, d?: IntentionalAny ) => merge( a, b, c, d );
Expand Down
4 changes: 2 additions & 2 deletions js/types/ExclusiveIntersection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ type ExclusiveIntersection<A,
B extends { [K in keyof B]: K extends keyof A ? never : B[K] },

// assumes A and B have something, so we don't end up with {} & {} & {}
C extends { [K in keyof C]: K extends keyof A ? never : K extends keyof B ? never : C[K] } = {}, // eslint-disable-line @typescript-eslint/ban-types
D extends { [K in keyof D]: K extends keyof A ? never : K extends keyof B ? never : K extends keyof C ? never : D[K] } = {}> // eslint-disable-line @typescript-eslint/ban-types
C extends { [K in keyof C]: K extends keyof A ? never : K extends keyof B ? never : C[K] } = {}, // eslint-disable-line @typescript-eslint/no-restricted-types
D extends { [K in keyof D]: K extends keyof A ? never : K extends keyof B ? never : K extends keyof C ? never : D[K] } = {}> // eslint-disable-line @typescript-eslint/no-restricted-types
= A & B & C & D;

export default ExclusiveIntersection;
2 changes: 1 addition & 1 deletion js/types/OptionalKeys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
* @author Sam Reid (PhET Interactive Simulations)
*/

type OptionalKeys<T> = { [K in keyof T]-?: {} extends Pick<T, K> ? K : never }[keyof T]; // eslint-disable-line @typescript-eslint/ban-types
type OptionalKeys<T> = { [K in keyof T]-?: {} extends Pick<T, K> ? K : never }[keyof T]; // eslint-disable-line @typescript-eslint/no-restricted-types

export default OptionalKeys;
2 changes: 1 addition & 1 deletion js/types/RequiredKeys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
* @author Sam Reid (PhET Interactive Simulations)
*/

type RequiredKeys<T> = { [K in keyof T]-?: {} extends Pick<T, K> ? never : K }[keyof T]; // eslint-disable-line @typescript-eslint/ban-types
type RequiredKeys<T> = { [K in keyof T]-?: {} extends Pick<T, K> ? never : K }[keyof T]; // eslint-disable-line @typescript-eslint/no-restricted-types

export default RequiredKeys;

0 comments on commit ea48154

Please sign in to comment.