commit
6febe3b503
|
@ -546,7 +546,7 @@ namespace ts {
|
|||
|
||||
function getLanguageVariant(fileName: string) {
|
||||
// .tsx and .jsx files are treated as jsx language variant.
|
||||
return fileExtensionIs(fileName, ".tsx") || fileExtensionIs(fileName, ".jsx") ? LanguageVariant.JSX : LanguageVariant.Standard;
|
||||
return fileExtensionIs(fileName, ".tsx") || fileExtensionIs(fileName, ".jsx") || fileExtensionIs(fileName, ".js") ? LanguageVariant.JSX : LanguageVariant.Standard;
|
||||
}
|
||||
|
||||
function initializeState(fileName: string, _sourceText: string, languageVersion: ScriptTarget, isJavaScriptFile: boolean, _syntaxCursor: IncrementalParser.SyntaxCursor) {
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file.
|
||||
tests/cases/compiler/a.js(1,10): error TS8016: 'type assertion expressions' can only be used in a .ts file.
|
||||
tests/cases/compiler/a.js(1,10): error TS17008: JSX element 'string' has no corresponding closing tag.
|
||||
tests/cases/compiler/a.js(1,27): error TS1005: '</' expected.
|
||||
|
||||
|
||||
!!! error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file.
|
||||
==== tests/cases/compiler/a.js (1 errors) ====
|
||||
==== tests/cases/compiler/a.js (2 errors) ====
|
||||
var v = <string>undefined;
|
||||
~~~~~~
|
||||
!!! error TS8016: 'type assertion expressions' can only be used in a .ts file.
|
||||
!!! error TS17008: JSX element 'string' has no corresponding closing tag.
|
||||
|
||||
!!! error TS1005: '</' expected.
|
|
@ -1,16 +0,0 @@
|
|||
/// <reference path="fourslash.ts" />
|
||||
|
||||
// @allowJs: true
|
||||
// @Filename: a.js
|
||||
//// var v = <string>undefined;
|
||||
|
||||
verify.getSyntacticDiagnostics(`[]`);
|
||||
verify.getSemanticDiagnostics(`[
|
||||
{
|
||||
"message": "'type assertion expressions' can only be used in a .ts file.",
|
||||
"start": 9,
|
||||
"length": 6,
|
||||
"category": "error",
|
||||
"code": 8016
|
||||
}
|
||||
]`);
|
Loading…
Reference in a new issue