@@ -1287,7 +1287,7 @@ namespace ts {
12871287 case "string" :
12881288 return mapDefined ( values , v => validateJsonOptionValue ( opt . element , v || "" , errors ) ) ;
12891289 default :
1290- return mapDefined ( values , v => parseCustomTypeOption ( < CommandLineOptionOfCustomType > opt . element , v , errors ) ) ;
1290+ return mapDefined ( values , v => parseCustomTypeOption ( opt . element as CommandLineOptionOfCustomType , v , errors ) ) ;
12911291 }
12921292 }
12931293
@@ -1466,7 +1466,7 @@ namespace ts {
14661466 break ;
14671467 // If not a primitive, the possible types are specified in what is effectively a map of options.
14681468 default :
1469- options [ opt . name ] = parseCustomTypeOption ( < CommandLineOptionOfCustomType > opt , args [ i ] , errors ) ;
1469+ options [ opt . name ] = parseCustomTypeOption ( opt as CommandLineOptionOfCustomType , args [ i ] , errors ) ;
14701470 i ++ ;
14711471 break ;
14721472 }
@@ -1570,7 +1570,7 @@ namespace ts {
15701570 /* @internal */
15711571 export function getDiagnosticText ( _message : DiagnosticMessage , ..._args : any [ ] ) : string {
15721572 const diagnostic = createCompilerDiagnostic . apply ( undefined , arguments ) ;
1573- return < string > diagnostic . messageText ;
1573+ return diagnostic . messageText as string ;
15741574 }
15751575
15761576 export type DiagnosticReporter = ( diagnostic : Diagnostic ) => void ;
@@ -1654,7 +1654,7 @@ namespace ts {
16541654 */
16551655 export function readJsonConfigFile ( fileName : string , readFile : ( path : string ) => string | undefined ) : TsConfigSourceFile {
16561656 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 ;
16581658 }
16591659
16601660 /*@internal */
@@ -1961,9 +1961,9 @@ namespace ts {
19611961 errors . push ( createDiagnosticForNodeInSourceFile ( sourceFile , valueExpression , Diagnostics . String_literal_with_double_quotes_expected ) ) ;
19621962 }
19631963 reportInvalidOptionValue ( option && ( isString ( option . type ) && option . type !== "string" ) ) ;
1964- const text = ( < StringLiteral > valueExpression ) . text ;
1964+ const text = ( valueExpression as StringLiteral ) . text ;
19651965 if ( option && ! isString ( option . type ) ) {
1966- const customOption = < CommandLineOptionOfCustomType > option ;
1966+ const customOption = option as CommandLineOptionOfCustomType ;
19671967 // Validate custom option type
19681968 if ( ! customOption . type . has ( text . toLowerCase ( ) ) ) {
19691969 errors . push (
@@ -1979,18 +1979,18 @@ namespace ts {
19791979
19801980 case SyntaxKind . NumericLiteral :
19811981 reportInvalidOptionValue ( option && option . type !== "number" ) ;
1982- return validateValue ( Number ( ( < NumericLiteral > valueExpression ) . text ) ) ;
1982+ return validateValue ( Number ( ( valueExpression as NumericLiteral ) . text ) ) ;
19831983
19841984 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 ) {
19861986 break ; // not valid JSON syntax
19871987 }
19881988 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 ) ) ;
19901990
19911991 case SyntaxKind . ObjectLiteralExpression :
19921992 reportInvalidOptionValue ( option && option . type !== "object" ) ;
1993- const objectLiteralExpression = < ObjectLiteralExpression > valueExpression ;
1993+ const objectLiteralExpression = valueExpression as ObjectLiteralExpression ;
19941994
19951995 // Currently having element option declaration in the tsconfig with type "object"
19961996 // determines if it needs onSetValidOptionKeyValueInParent callback or not
@@ -1999,7 +1999,7 @@ namespace ts {
19991999 // vs what we set in the json
20002000 // If need arises, we can modify this interface and callbacks as needed
20012001 if ( option ) {
2002- const { elementOptions, extraKeyDiagnostics, name : optionName } = < TsConfigOnlyOption > option ;
2002+ const { elementOptions, extraKeyDiagnostics, name : optionName } = option as TsConfigOnlyOption ;
20032003 return validateValue ( convertObjectLiteralExpressionToJson ( objectLiteralExpression ,
20042004 elementOptions , extraKeyDiagnostics , optionName ) ) ;
20052005 }
@@ -2012,8 +2012,8 @@ namespace ts {
20122012 case SyntaxKind . ArrayLiteralExpression :
20132013 reportInvalidOptionValue ( option && option . type !== "list" ) ;
20142014 return validateValue ( convertArrayLiteralExpressionToJson (
2015- ( < ArrayLiteralExpression > valueExpression ) . elements ,
2016- option && ( < CommandLineOptionOfListType > option ) . element ) ) ;
2015+ ( valueExpression as ArrayLiteralExpression ) . elements ,
2016+ option && ( option as CommandLineOptionOfListType ) . element ) ) ;
20172017 }
20182018
20192019 // Not in expected format
@@ -2172,7 +2172,7 @@ namespace ts {
21722172 return getCustomTypeMapOfCommandLineOption ( optionDefinition . element ) ;
21732173 }
21742174 else {
2175- return ( < CommandLineOptionOfCustomType > optionDefinition ) . type ;
2175+ return ( optionDefinition as CommandLineOptionOfCustomType ) . type ;
21762176 }
21772177 }
21782178
@@ -2211,7 +2211,7 @@ namespace ts {
22112211 if ( optionsNameMap . has ( name ) && optionsNameMap . get ( name ) ! . category === Diagnostics . Command_line_Options ) {
22122212 continue ;
22132213 }
2214- const value = < CompilerOptionsValue > options [ name ] ;
2214+ const value = options [ name ] as CompilerOptionsValue ;
22152215 const optionDefinition = optionsNameMap . get ( name . toLowerCase ( ) ) ;
22162216 if ( optionDefinition ) {
22172217 const customTypeMap = getCustomTypeMapOfCommandLineOption ( optionDefinition ) ;
@@ -2782,7 +2782,7 @@ namespace ts {
27822782 case "extends" :
27832783 const newBase = configFileName ? directoryOfCombinedPath ( configFileName , basePath ) : basePath ;
27842784 extendedConfigPath = getExtendsConfigPath (
2785- < string > value ,
2785+ value as string ,
27862786 host ,
27872787 newBase ,
27882788 errors ,
@@ -2972,10 +2972,10 @@ namespace ts {
29722972 if ( isCompilerOptionsValue ( opt , value ) ) {
29732973 const optType = opt . type ;
29742974 if ( optType === "list" && isArray ( value ) ) {
2975- return convertJsonOptionOfListType ( < CommandLineOptionOfListType > opt , value , basePath , errors ) ;
2975+ return convertJsonOptionOfListType ( opt as CommandLineOptionOfListType , value , basePath , errors ) ;
29762976 }
29772977 else if ( ! isString ( optType ) ) {
2978- return convertJsonOptionOfCustomType ( < CommandLineOptionOfCustomType > opt , < string > value , errors ) ;
2978+ return convertJsonOptionOfCustomType ( opt as CommandLineOptionOfCustomType , value as string , errors ) ;
29792979 }
29802980 const validatedValue = validateJsonOptionValue ( opt , value , errors ) ;
29812981 return isNullOrUndefined ( validatedValue ) ? validatedValue : normalizeNonListOptionValue ( opt , basePath , validatedValue ) ;
@@ -2990,7 +2990,7 @@ namespace ts {
29902990 if ( option . type === "list" ) {
29912991 const listOption = option ;
29922992 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 ;
29942994 }
29952995 return value ;
29962996 }
0 commit comments