File tree Expand file tree Collapse file tree 2 files changed +29
-29
lines changed Expand file tree Collapse file tree 2 files changed +29
-29
lines changed Original file line number Diff line number Diff line change @@ -2094,4 +2094,33 @@ namespace ts {
2094
2094
// pos === undefined || pos === null || isNaN(pos) || pos < 0;
2095
2095
return ! ( pos >= 0 ) ;
2096
2096
}
2097
+
2098
+ /** True if an extension is one of the supported TypeScript extensions. */
2099
+ export function extensionIsTypeScript ( ext : Extension ) : boolean {
2100
+ return ext <= Extension . LastTypeScriptExtension ;
2101
+ }
2102
+
2103
+ /**
2104
+ * Gets the extension from a path.
2105
+ * Path must have a valid extension.
2106
+ */
2107
+ export function extensionFromPath ( path : string ) : Extension {
2108
+ if ( fileExtensionIs ( path , ".d.ts" ) ) {
2109
+ return Extension . Dts ;
2110
+ }
2111
+ if ( fileExtensionIs ( path , ".ts" ) ) {
2112
+ return Extension . Ts ;
2113
+ }
2114
+ if ( fileExtensionIs ( path , ".tsx" ) ) {
2115
+ return Extension . Tsx ;
2116
+ }
2117
+ if ( fileExtensionIs ( path , ".js" ) ) {
2118
+ return Extension . Js ;
2119
+ }
2120
+ if ( fileExtensionIs ( path , ".jsx" ) ) {
2121
+ return Extension . Jsx ;
2122
+ }
2123
+ Debug . fail ( `File ${ path } has unknown extension.` ) ;
2124
+ return Extension . Js ;
2125
+ }
2097
2126
}
Original file line number Diff line number Diff line change @@ -118,35 +118,6 @@ namespace ts {
118
118
oldResolution . resolvedFileName === newResolution . resolvedFileName ;
119
119
}
120
120
121
- /** True if an extension is one of the supported TypeScript extensions. */
122
- export function extensionIsTypeScript ( ext : Extension ) : boolean {
123
- return ext <= Extension . LastTypeScriptExtension ;
124
- }
125
-
126
- /**
127
- * Gets the extension from a path.
128
- * Path must have a valid extension.
129
- */
130
- export function extensionFromPath ( path : string ) : Extension {
131
- if ( fileExtensionIs ( path , ".d.ts" ) ) {
132
- return Extension . Dts ;
133
- }
134
- if ( fileExtensionIs ( path , ".ts" ) ) {
135
- return Extension . Ts ;
136
- }
137
- if ( fileExtensionIs ( path , ".tsx" ) ) {
138
- return Extension . Tsx ;
139
- }
140
- if ( fileExtensionIs ( path , ".js" ) ) {
141
- return Extension . Js ;
142
- }
143
- if ( fileExtensionIs ( path , ".jsx" ) ) {
144
- return Extension . Jsx ;
145
- }
146
- Debug . fail ( `File ${ path } has unknown extension.` ) ;
147
- return Extension . Js ;
148
- }
149
-
150
121
/* @internal */
151
122
export function typeDirectiveIsEqualTo ( oldResolution : ResolvedTypeReferenceDirective , newResolution : ResolvedTypeReferenceDirective ) : boolean {
152
123
return oldResolution . resolvedFileName === newResolution . resolvedFileName && oldResolution . primary === newResolution . primary ;
You can’t perform that action at this time.
0 commit comments