@@ -1287,7 +1287,7 @@ namespace ts {
1287
1287
case "string" :
1288
1288
return mapDefined ( values , v => validateJsonOptionValue ( opt . element , v || "" , errors ) ) ;
1289
1289
default :
1290
- return mapDefined ( values , v => parseCustomTypeOption ( < CommandLineOptionOfCustomType > opt . element , v , errors ) ) ;
1290
+ return mapDefined ( values , v => parseCustomTypeOption ( opt . element as CommandLineOptionOfCustomType , v , errors ) ) ;
1291
1291
}
1292
1292
}
1293
1293
@@ -1466,7 +1466,7 @@ namespace ts {
1466
1466
break ;
1467
1467
// If not a primitive, the possible types are specified in what is effectively a map of options.
1468
1468
default :
1469
- options [ opt . name ] = parseCustomTypeOption ( < CommandLineOptionOfCustomType > opt , args [ i ] , errors ) ;
1469
+ options [ opt . name ] = parseCustomTypeOption ( opt as CommandLineOptionOfCustomType , args [ i ] , errors ) ;
1470
1470
i ++ ;
1471
1471
break ;
1472
1472
}
@@ -1570,7 +1570,7 @@ namespace ts {
1570
1570
/* @internal */
1571
1571
export function getDiagnosticText ( _message : DiagnosticMessage , ..._args : any [ ] ) : string {
1572
1572
const diagnostic = createCompilerDiagnostic . apply ( undefined , arguments ) ;
1573
- return < string > diagnostic . messageText ;
1573
+ return diagnostic . messageText as string ;
1574
1574
}
1575
1575
1576
1576
export type DiagnosticReporter = ( diagnostic : Diagnostic ) => void ;
@@ -1654,7 +1654,7 @@ namespace ts {
1654
1654
*/
1655
1655
export function readJsonConfigFile ( fileName : string , readFile : ( path : string ) => string | undefined ) : TsConfigSourceFile {
1656
1656
const textOrDiagnostic = tryReadFile ( fileName , readFile ) ;
1657
- return isString ( textOrDiagnostic ) ? parseJsonText ( fileName , textOrDiagnostic ) : < TsConfigSourceFile > { fileName, parseDiagnostics : [ textOrDiagnostic ] } ;
1657
+ return isString ( textOrDiagnostic ) ? parseJsonText ( fileName , textOrDiagnostic ) : { fileName, parseDiagnostics : [ textOrDiagnostic ] } as TsConfigSourceFile ;
1658
1658
}
1659
1659
1660
1660
/*@internal */
@@ -1961,9 +1961,9 @@ namespace ts {
1961
1961
errors . push ( createDiagnosticForNodeInSourceFile ( sourceFile , valueExpression , Diagnostics . String_literal_with_double_quotes_expected ) ) ;
1962
1962
}
1963
1963
reportInvalidOptionValue ( option && ( isString ( option . type ) && option . type !== "string" ) ) ;
1964
- const text = ( < StringLiteral > valueExpression ) . text ;
1964
+ const text = ( valueExpression as StringLiteral ) . text ;
1965
1965
if ( option && ! isString ( option . type ) ) {
1966
- const customOption = < CommandLineOptionOfCustomType > option ;
1966
+ const customOption = option as CommandLineOptionOfCustomType ;
1967
1967
// Validate custom option type
1968
1968
if ( ! customOption . type . has ( text . toLowerCase ( ) ) ) {
1969
1969
errors . push (
@@ -1979,18 +1979,18 @@ namespace ts {
1979
1979
1980
1980
case SyntaxKind . NumericLiteral :
1981
1981
reportInvalidOptionValue ( option && option . type !== "number" ) ;
1982
- return validateValue ( Number ( ( < NumericLiteral > valueExpression ) . text ) ) ;
1982
+ return validateValue ( Number ( ( valueExpression as NumericLiteral ) . text ) ) ;
1983
1983
1984
1984
case SyntaxKind . PrefixUnaryExpression :
1985
- if ( ( < PrefixUnaryExpression > valueExpression ) . operator !== SyntaxKind . MinusToken || ( < PrefixUnaryExpression > valueExpression ) . operand . kind !== SyntaxKind . NumericLiteral ) {
1985
+ if ( ( valueExpression as PrefixUnaryExpression ) . operator !== SyntaxKind . MinusToken || ( valueExpression as PrefixUnaryExpression ) . operand . kind !== SyntaxKind . NumericLiteral ) {
1986
1986
break ; // not valid JSON syntax
1987
1987
}
1988
1988
reportInvalidOptionValue ( option && option . type !== "number" ) ;
1989
- return validateValue ( - Number ( ( < NumericLiteral > ( < PrefixUnaryExpression > valueExpression ) . operand ) . text ) ) ;
1989
+ return validateValue ( - Number ( ( ( valueExpression as PrefixUnaryExpression ) . operand as NumericLiteral ) . text ) ) ;
1990
1990
1991
1991
case SyntaxKind . ObjectLiteralExpression :
1992
1992
reportInvalidOptionValue ( option && option . type !== "object" ) ;
1993
- const objectLiteralExpression = < ObjectLiteralExpression > valueExpression ;
1993
+ const objectLiteralExpression = valueExpression as ObjectLiteralExpression ;
1994
1994
1995
1995
// Currently having element option declaration in the tsconfig with type "object"
1996
1996
// determines if it needs onSetValidOptionKeyValueInParent callback or not
@@ -1999,7 +1999,7 @@ namespace ts {
1999
1999
// vs what we set in the json
2000
2000
// If need arises, we can modify this interface and callbacks as needed
2001
2001
if ( option ) {
2002
- const { elementOptions, extraKeyDiagnostics, name : optionName } = < TsConfigOnlyOption > option ;
2002
+ const { elementOptions, extraKeyDiagnostics, name : optionName } = option as TsConfigOnlyOption ;
2003
2003
return validateValue ( convertObjectLiteralExpressionToJson ( objectLiteralExpression ,
2004
2004
elementOptions , extraKeyDiagnostics , optionName ) ) ;
2005
2005
}
@@ -2012,8 +2012,8 @@ namespace ts {
2012
2012
case SyntaxKind . ArrayLiteralExpression :
2013
2013
reportInvalidOptionValue ( option && option . type !== "list" ) ;
2014
2014
return validateValue ( convertArrayLiteralExpressionToJson (
2015
- ( < ArrayLiteralExpression > valueExpression ) . elements ,
2016
- option && ( < CommandLineOptionOfListType > option ) . element ) ) ;
2015
+ ( valueExpression as ArrayLiteralExpression ) . elements ,
2016
+ option && ( option as CommandLineOptionOfListType ) . element ) ) ;
2017
2017
}
2018
2018
2019
2019
// Not in expected format
@@ -2172,7 +2172,7 @@ namespace ts {
2172
2172
return getCustomTypeMapOfCommandLineOption ( optionDefinition . element ) ;
2173
2173
}
2174
2174
else {
2175
- return ( < CommandLineOptionOfCustomType > optionDefinition ) . type ;
2175
+ return ( optionDefinition as CommandLineOptionOfCustomType ) . type ;
2176
2176
}
2177
2177
}
2178
2178
@@ -2211,7 +2211,7 @@ namespace ts {
2211
2211
if ( optionsNameMap . has ( name ) && optionsNameMap . get ( name ) ! . category === Diagnostics . Command_line_Options ) {
2212
2212
continue ;
2213
2213
}
2214
- const value = < CompilerOptionsValue > options [ name ] ;
2214
+ const value = options [ name ] as CompilerOptionsValue ;
2215
2215
const optionDefinition = optionsNameMap . get ( name . toLowerCase ( ) ) ;
2216
2216
if ( optionDefinition ) {
2217
2217
const customTypeMap = getCustomTypeMapOfCommandLineOption ( optionDefinition ) ;
@@ -2782,7 +2782,7 @@ namespace ts {
2782
2782
case "extends" :
2783
2783
const newBase = configFileName ? directoryOfCombinedPath ( configFileName , basePath ) : basePath ;
2784
2784
extendedConfigPath = getExtendsConfigPath (
2785
- < string > value ,
2785
+ value as string ,
2786
2786
host ,
2787
2787
newBase ,
2788
2788
errors ,
@@ -2972,10 +2972,10 @@ namespace ts {
2972
2972
if ( isCompilerOptionsValue ( opt , value ) ) {
2973
2973
const optType = opt . type ;
2974
2974
if ( optType === "list" && isArray ( value ) ) {
2975
- return convertJsonOptionOfListType ( < CommandLineOptionOfListType > opt , value , basePath , errors ) ;
2975
+ return convertJsonOptionOfListType ( opt as CommandLineOptionOfListType , value , basePath , errors ) ;
2976
2976
}
2977
2977
else if ( ! isString ( optType ) ) {
2978
- return convertJsonOptionOfCustomType ( < CommandLineOptionOfCustomType > opt , < string > value , errors ) ;
2978
+ return convertJsonOptionOfCustomType ( opt as CommandLineOptionOfCustomType , value as string , errors ) ;
2979
2979
}
2980
2980
const validatedValue = validateJsonOptionValue ( opt , value , errors ) ;
2981
2981
return isNullOrUndefined ( validatedValue ) ? validatedValue : normalizeNonListOptionValue ( opt , basePath , validatedValue ) ;
@@ -2990,7 +2990,7 @@ namespace ts {
2990
2990
if ( option . type === "list" ) {
2991
2991
const listOption = option ;
2992
2992
if ( listOption . element . isFilePath || ! isString ( listOption . element . type ) ) {
2993
- return < CompilerOptionsValue > filter ( map ( value , v => normalizeOptionValue ( listOption . element , basePath , v ) ) , v => ! ! v ) ;
2993
+ return filter ( map ( value , v => normalizeOptionValue ( listOption . element , basePath , v ) ) , v => ! ! v ) as CompilerOptionsValue ;
2994
2994
}
2995
2995
return value ;
2996
2996
}
0 commit comments