8000 Remove extraneous parameters from FlagFile.ts · nirshar/rushstack@203c710 · GitHub
[go: up one dir, main page]

Skip to content

Commit 203c710

Browse files
committed
Remove extraneous parameters from FlagFile.ts
1 parent 890322a commit 203c710

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

common/reviews/api/rush-lib.api.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -311,13 +311,12 @@ export class FileSystemBuildCacheProvider {
311311
}
312312

313313
// @internal
314-
export class _FlagFile<T extends object = JsonObject> {
315-
constructor(folderPath: string, flagName: string, initialState?: T);
314+
export class _FlagFile {
315+
constructor(folderPath: string, flagName: string, initialState?: JsonObject);
316316
clearAsync(): Promise<void>;
317317
createAsync(): Promise<void>;
318318
isValidAsync(): Promise<boolean>;
319319
readonly path: string;
320-
protected _state: T | {};
321320
}
322321

323322
// @beta

libraries/rush-lib/src/api/FlagFile.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { objectsAreDeepEqual } from '../utilities/objectUtilities';
88
* A base class for flag file.
99
* @internal
1010
*/
11-
export class FlagFile<T extends object = JsonObject> {
11+
export class FlagFile {
1212
/**
1313
* Flag file path
1414
*/
@@ -17,14 +17,14 @@ export class FlagFile<T extends object = JsonObject> {
1717
/**
1818
* Content of the flag
1919
*/
20-
protected _state: T | {};
20+
private _state: JsonObject;
2121

2222
/**
2323
* Creates a new flag file
2424
* @param folderPath - the folder that this flag is managing
2525
* @param state - optional, the state that should be managed or compared
2626
*/
27-
public constructor(folderPath: string, flagName: string, initialState?: T) {
27+
public constructor(folderPath: string, flagName: string, initialState?: JsonObject) {
2828
this.path = `${folderPath}/${flagName}.flag`;
2929
this._state = initialState || {};
3030
}
@@ -33,10 +33,10 @@ export class FlagFile<T extends object = JsonObject> {
3333
* Returns true if the file exists and the contents match the current state.
3434
*/
3535
public async isValidAsync(): Promise<boolean> {
36-
let oldState: T | undefined;
36+
let oldState: JsonObject | undefined;
3737
try {
3838
oldState = await JsonFile.loadAsync(this.path);
39-
const newState: T | {} = this._state;
39+
const newState: JsonObject = this._state;
4040
return objectsAreDeepEqual(oldState, newState);
4141
} catch (err) {
4242
return false;

0 commit comments

Comments
 (0)
0