Commit e994d8c 1 parent a3f81e1 commit e994d8c Copy full SHA for e994d8c
File tree 2 files changed +12
-3
lines changed
2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ export interface AliasPieceOptions extends PieceOptions {
11
11
/**
12
12
* The piece to be stored in {@link AliasStore} instances.
13
13
*/
14
- export class AliasPiece extends Piece {
14
+ export class AliasPiece < O extends AliasPieceOptions = AliasPieceOptions > extends Piece < O > {
15
15
/**
16
16
* The aliases for the piece.
17
17
*/
@@ -38,4 +38,5 @@ export class AliasPiece extends Piece {
38
38
*/
39
39
export interface AliasPieceJSON extends PieceJSON {
40
40
aliases : string [ ] ;
41
+ options : AliasPieceOptions ;
41
42
}
Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ export interface PieceOptions {
49
49
/**
50
50
* The piece to be stored in {@link Store} instances.
51
51
*/
52
- export class Piece {
52
+ export class Piece < O extends PieceOptions = PieceOptions > {
53
53
/**
54
54
* The store that contains the piece.
55
55
*/
@@ -70,11 +70,17 @@ export class Piece {
70
70
*/
71
71
public enabled : boolean ;
72
72
73
+ /**
74
+ * The raw options passed to this {@link Piece}
75
+ */
76
+ public readonly options : O ;
77
+
73
78
public constructor ( context : PieceContext , options : PieceOptions = { } ) {
74
79
this . store = context . store ;
75
80
this . location = new PieceLocation ( context . path , context . root ) ;
76
81
this . name = options . name ?? context . name ;
77
82
this . enabled = options . enabled ?? true ;
83
+ this . options = options as O ;
78
84
}
79
85
80
86
/**
@@ -123,7 +129,8 @@ export class Piece {
123
129
return {
124
130
location : this . location . toJSON ( ) ,
125
131
name : this . name ,
126
- enabled : this . enabled
132
+ enabled : this . enabled ,
133
+ options : this . options
127
134
} ;
128
135
}
129
136
}
@@ -135,4 +142,5 @@ export interface PieceJSON {
135
142
location : PieceLocationJSON ;
136
143
name : string ;
137
144
enabled : boolean ;
145
+ options : PieceOptions ;
138
146
}
You can’t perform that action at this time.
0 commit comments