Skip to content

Commit a74f9c3

Browse files
authored
Enable useDefineForClassFields and fix affected TS files. (#2447)
* Enable useDefineForClassFields and fix affected TS files. Fixes #2419 Turning off this TS compiler option is deprecated, and it will be removed "soon". It's annoying.. but oh well.
1 parent 5740eb5 commit a74f9c3

20 files changed

+29
-35
lines changed

pkg/sass-parser/lib/src/configured-variable.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ export class ConfiguredVariable extends Node {
100100
* This is the parsed and normalized value, with underscores converted to
101101
* hyphens and escapes resolved to the characters they represent.
102102
*/
103-
name!: string;
103+
declare name: string;
104104

105105
/** The expresison whose value the variable is assigned. */
106106
get expression(): Expression {
@@ -112,10 +112,10 @@ export class ConfiguredVariable extends Node {
112112
if (value) value.parent = this;
113113
this._expression = value;
114114
}
115-
private _expression!: Expression;
115+
private declare _expression: Expression;
116116

117117
/** Whether this has a `!default` guard. */
118-
guarded!: boolean;
118+
declare guarded: boolean;
119119

120120
constructor(defaults: ConfiguredVariableProps);
121121
/** @hidden */

pkg/sass-parser/lib/src/expression/binary-operation.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export class BinaryOperationExpression extends Expression {
7676
// TODO - postcss/postcss#1957: Mark this as dirty
7777
this._operator = operator;
7878
}
79-
private _operator!: BinaryOperator;
79+
private declare _operator: BinaryOperator;
8080

8181
/** The expression on the left-hand side of this operation. */
8282
get left(): Expression {
@@ -89,7 +89,7 @@ export class BinaryOperationExpression extends Expression {
8989
left.parent = this;
9090
this._left = left;
9191
}
92-
private _left!: Expression;
92+
private declare _left: Expression;
9393

9494
/** The expression on the right-hand side of this operation. */
9595
get right(): Expression {
@@ -102,7 +102,7 @@ export class BinaryOperationExpression extends Expression {
102102
right.parent = this;
103103
this._right = right;
104104
}
105-
private _right!: Expression;
105+
private declare _right: Expression;
106106

107107
constructor(defaults: BinaryOperationExpressionProps);
108108
/** @hidden */

pkg/sass-parser/lib/src/expression/boolean.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export class BooleanExpression extends Expression {
4444
// TODO - postcss/postcss#1957: Mark this as dirty
4545
this._value = value;
4646
}
47-
private _value!: boolean;
47+
private declare _value: boolean;
4848

4949
constructor(defaults: BooleanExpressionProps);
5050
/** @hidden */

pkg/sass-parser/lib/src/expression/number.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export class NumberExpression extends Expression {
5454
// TODO - postcss/postcss#1957: Mark this as dirty
5555
this._value = value;
5656
}
57-
private _value!: number;
57+
private declare _value: number;
5858

5959
/** The denominator units of this number. */
6060
get unit(): string | null {
@@ -64,7 +64,7 @@ export class NumberExpression extends Expression {
6464
// TODO - postcss/postcss#1957: Mark this as dirty
6565
this._unit = unit;
6666
}
67-
private _unit!: string | null;
67+
private declare _unit: string | null;
6868

6969
/** Whether the number is unitless. */
7070
isUnitless(): boolean {

pkg/sass-parser/lib/src/expression/string.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export class StringExpression extends Expression {
5555
text.parent = this;
5656
this._text = text;
5757
}
58-
private _text!: Interpolation;
58+
private declare _text: Interpolation;
5959

6060
// TODO: provide a utility asPlainIdentifier method that returns the value of
6161
// an identifier with any escapes resolved, if this is indeed a valid unquoted
@@ -75,7 +75,7 @@ export class StringExpression extends Expression {
7575
// TODO - postcss/postcss#1957: Mark this as dirty
7676
this._quotes = quotes;
7777
}
78-
private _quotes!: boolean;
78+
private declare _quotes: boolean;
7979

8080
constructor(defaults: StringExpressionProps);
8181
/** @hidden */

pkg/sass-parser/lib/src/interpolation.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ export class Interpolation
104104
// This *should* only ever be called by the superclass constructor.
105105
this._nodes = nodes;
106106
}
107-
private _nodes?: Array<string | Expression>;
107+
private declare _nodes?: Array<string | Expression>;
108108

109109
/** Returns whether this contains no interpolated expressions. */
110110
get isPlain(): boolean {

pkg/sass-parser/lib/src/parameter-list.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ export class ParameterList
9797
// This *should* only ever be called by the superclass constructor.
9898
this._nodes = nodes;
9999
}
100-
private _nodes?: Array<Parameter>;
100+
private declare _nodes?: Array<Parameter>;
101101

102102
/**
103103
* The name of the rest parameter (such as `args` in `...$args`) in this

pkg/sass-parser/lib/src/statement/css-comment.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export class CssComment
7878
textInterpolation.parent = this;
7979
this._textInterpolation = textInterpolation;
8080
}
81-
private _textInterpolation?: Interpolation;
81+
private declare _textInterpolation?: Interpolation;
8282

8383
constructor(defaults: CssCommentProps);
8484
/** @hidden */

pkg/sass-parser/lib/src/statement/debug-rule.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export class DebugRule
7878
if (debugExpression) debugExpression.parent = this;
7979
this._debugExpression = debugExpression;
8080
}
81-
private _debugExpression?: Expression;
81+
private declare _debugExpression?: Expression;
8282

8383
constructor(defaults: DebugRuleProps);
8484
/** @hidden */

pkg/sass-parser/lib/src/statement/each-rule.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ export class EachRule
107107
if (eachExpression) eachExpression.parent = this;
108108
this._eachExpression = eachExpression;
109109
}
110-
private _eachExpression?: Expression;
110+
private declare _eachExpression?: Expression;
111111

112112
constructor(defaults: EachRuleProps);
113113
/** @hidden */

pkg/sass-parser/lib/src/statement/error-rule.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export class ErrorRule
7878
if (errorExpression) errorExpression.parent = this;
7979
this._errorExpression = errorExpression;
8080
}
81-
private _errorExpression?: Expression;
81+
private declare _errorExpression?: Expression;
8282

8383
constructor(defaults: ErrorRuleProps);
8484
/** @hidden */

pkg/sass-parser/lib/src/statement/for-rule.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ export class ForRule
114114
if (fromExpression) fromExpression.parent = this;
115115
this._fromExpression = fromExpression;
116116
}
117-
private _fromExpression?: Expression;
117+
private declare _fromExpression?: Expression;
118118

119119
/** The expresison whose value is the ending point of the iteration. */
120120
get toExpression(): Expression {
@@ -128,7 +128,7 @@ export class ForRule
128128
if (toExpression) toExpression.parent = this;
129129
this._toExpression = toExpression;
130130
}
131-
private _toExpression?: Expression;
131+
private declare _toExpression?: Expression;
132132

133133
constructor(defaults: ForRuleProps);
134134
/** @hidden */

pkg/sass-parser/lib/src/statement/forward-rule.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export interface ForwardRuleRaws extends Omit<AtRuleRaws, 'params'> {
7878
afterWith?: string;
7979
}
8080

81-
/** The initilaizer properties for {@link ForwardMemberList}. */
81+
/** The initializer properties for {@link ForwardMemberList}. */
8282
export interface ForwardMemberProps {
8383
mixinsAndFunctions?: Iterable<string>;
8484
variables?: Iterable<string>;
@@ -229,7 +229,7 @@ export class ForwardRule
229229
: new Configuration(configuration);
230230
this._configuration.parent = this;
231231
}
232-
private _configuration!: Configuration;
232+
private declare _configuration: Configuration;
233233

234234
constructor(defaults: ForwardRuleProps);
235235
/** @hidden */

pkg/sass-parser/lib/src/statement/generic-at-rule.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export class GenericAtRule
9595
nameInterpolation.parent = this;
9696
this._nameInterpolation = nameInterpolation;
9797
}
98-
private _nameInterpolation?: Interpolation;
98+
private declare _nameInterpolation?: Interpolation;
9999

100100
get params(): string {
101101
if (this.name !== 'media' || !this.paramsInterpolation) {
@@ -145,7 +145,7 @@ export class GenericAtRule
145145
if (paramsInterpolation) paramsInterpolation.parent = this;
146146
this._paramsInterpolation = paramsInterpolation;
147147
}
148-
private _paramsInterpolation: Interpolation | undefined;
148+
private declare _paramsInterpolation: Interpolation | undefined;
149149

150150
constructor(defaults: GenericAtRuleProps);
151151
/** @hidden */

pkg/sass-parser/lib/src/statement/rule.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export class Rule extends _Rule implements Statement {
7979
selectorInterpolation.parent = this;
8080
this._selectorInterpolation = selectorInterpolation;
8181
}
82-
private _selectorInterpolation?: Interpolation;
82+
private declare _selectorInterpolation?: Interpolation;
8383

8484
constructor(defaults: RuleProps);
8585
constructor(_: undefined, inner: sassInternal.StyleRule);

pkg/sass-parser/lib/src/statement/use-rule.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ export class UseRule
151151
: new Configuration(configuration);
152152
this._configuration.parent = this;
153153
}
154-
private _configuration!: Configuration;
154+
private declare _configuration: Configuration;
155155

156156
constructor(defaults: UseRuleProps);
157157
/** @hidden */

pkg/sass-parser/lib/src/statement/variable-declaration.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ export class VariableDeclaration
106106
if (value) value.parent = this;
107107
this._expression = value;
108108
}
109-
private _expression!: Expression;
109+
private declare _expression: Expression;
110110

111111
/** Whether the variable has a `!default` flag. */
112112
declare guarded: boolean;

pkg/sass-parser/lib/src/statement/warn-rule.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export class WarnRule
7878
if (warnExpression) warnExpression.parent = this;
7979
this._warnExpression = warnExpression;
8080
}
81-
private _warnExpression?: Expression;
81+
private declare _warnExpression?: Expression;
8282

8383
constructor(defaults: WarnRuleProps);
8484
/** @hidden */

pkg/sass-parser/lib/src/statement/while-rule.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export class WhileRule
8383
if (whileCondition) whileCondition.parent = this;
8484
this._whileCondition = whileCondition;
8585
}
86-
private _whileCondition?: Expression;
86+
private declare _whileCondition?: Expression;
8787

8888
constructor(defaults: WhileRuleProps);
8989
/** @hidden */

pkg/sass-parser/tsconfig.json

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,7 @@
77
"resolveJsonModule": true,
88
"rootDir": ".",
99
"useUnknownInCatchVariables": false,
10-
"useDefineForClassFields": false,
1110
"declaration": true
1211
},
13-
"include": [
14-
"*.ts",
15-
"lib/**/*.ts",
16-
"tool/**/*.ts",
17-
"test/**/*.ts"
18-
]
12+
"include": ["*.ts", "lib/**/*.ts", "tool/**/*.ts", "test/**/*.ts"]
1913
}

0 commit comments

Comments
 (0)