@@ -47,12 +47,12 @@ namespace ts.codefix {
47
47
} ,
48
48
} ) ;
49
49
50
- function getPropertyDeclaration ( sourceFile : SourceFile , pos : number ) : PropertyDeclaration | undefined {
50
+ function getPropertyDeclaration ( sourceFile : SourceFile , pos : number ) : PropertyDeclaration | undefined {
51
51
const token = getTokenAtPosition ( sourceFile , pos ) ;
52
52
return isIdentifier ( token ) ? cast ( token . parent , isPropertyDeclaration ) : undefined ;
53
53
}
54
54
55
- function getActionForAddMissingDefiniteAssignmentAssertion ( context : CodeFixContext , propertyDeclaration : PropertyDeclaration ) : CodeFixAction {
55
+ function getActionForAddMissingDefiniteAssignmentAssertion ( context : CodeFixContext , propertyDeclaration : PropertyDeclaration ) : CodeFixAction {
56
56
const changes = textChanges . ChangeTracker . with ( context , t => addDefiniteAssignmentAssertion ( t , context . sourceFile , propertyDeclaration ) ) ;
57
57
return createCodeFixAction ( fixName , changes , [ Diagnostics . Add_definite_assignment_assertion_to_property_0 , propertyDeclaration . getText ( ) ] , fixIdAddDefiniteAssignmentAssertions , Diagnostics . Add_definite_assignment_assertions_to_all_uninitialized_properties ) ;
58
58
}
@@ -70,7 +70,7 @@ namespace ts.codefix {
70
70
changeTracker . replaceNode ( propertyDeclarationSourceFile , propertyDeclaration , property ) ;
71
71
}
72
72
73
- function getActionForAddMissingUndefinedType ( context : CodeFixContext , propertyDeclaration : PropertyDeclaration ) : CodeFixAction {
73
+ function getActionForAddMissingUndefinedType ( context : CodeFixContext , propertyDeclaration : PropertyDeclaration ) : CodeFixAction {
74
74
const changes = textChanges . ChangeTracker . with ( context , t => addUndefinedType ( t , context . sourceFile , propertyDeclaration ) ) ;
75
75
return createCodeFixAction ( fixName , changes , [ Diagnostics . Add_undefined_type_to_property_0 , propertyDeclaration . name . getText ( ) ] , fixIdAddUndefinedType , Diagnostics . Add_undefined_type_to_all_uninitialized_properties ) ;
76
76
}
@@ -91,7 +91,7 @@ namespace ts.codefix {
91
91
return createCodeFixAction ( fixName , changes , [ Diagnostics . Add_initializer_to_property_0 , propertyDeclaration . name . getText ( ) ] , fixIdAddInitializer , Diagnostics . Add_initializers_to_all_uninitialized_properties ) ;
92
92
}
93
93
94
- function addInitializer ( changeTracker : textChanges . ChangeTracker , propertyDeclarationSourceFile : SourceFile , propertyDeclaration : PropertyDeclaration , initializer : Expression ) : void {
94
+ function addInitializer ( changeTracker : textChanges . ChangeTracker , propertyDeclarationSourceFile : SourceFile , propertyDeclaration : PropertyDeclaration , initializer : Expression ) : void {
95
95
const property = updateProperty (
96
96
propertyDeclaration ,
97
97
propertyDeclaration . decorators ,
@@ -108,7 +108,7 @@ namespace ts.codefix {
108
108
return getDefaultValueFromType ( checker , checker . getTypeFromTypeNode ( propertyDeclaration . type ! ) ) ; // TODO: GH#18217
109
109
}
110
110
111
- function getDefaultValueFromType ( checker : TypeChecker , type : Type ) : Expression | undefined {
111
+ function getDefaultValueFromType ( checker : TypeChecker , type : Type ) : Expression | undefined {
112
112
if ( type . flags & TypeFlags . BooleanLiteral ) {
113
113
return ( type === checker . getFalseType ( ) || type === checker . getFalseType ( /*fresh*/ true ) ) ? createFalse ( ) : createTrue ( ) ;
114
114
}
0 commit comments