diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 35c74a7ef48..33742378b61 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -4569,12 +4569,12 @@ module ts { if (identifier) { // ImportedDefaultBinding: // ImportedBinding - importClause.defaultBinding = identifier; + importClause.name = identifier; } // If there was no default import or if there is comma token after default import // parse namespace or named imports - if (!importClause.defaultBinding || + if (!importClause.name || parseOptional(SyntaxKind.CommaToken)) { importClause.namedBindings = token === SyntaxKind.AsteriskToken ? parseNamespaceImport() : parseNamedImports(); } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index d1410240911..d46e31dc982 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -878,13 +878,13 @@ module ts { } // In case of: - // import d from "mod" => defaultBinding = d, namedBinding = undefined - // import * as ns from "mod" => defaultBinding = undefined, namedBinding: NamespaceImport = { name: ns } - // import d, * as ns from "mod" => defaultBinding = d, namedBinding: NamespaceImport = { name: ns } - // import { a, b as x } from "mod" => defaultBinding = undefined, namedBinding: NamedImports = { elements: [{ name: a }, { name: x, propertyName: b}]} - // import d, { a, b as x } from "mod" => defaultBinding = d, namedBinding: NamedImports = { elements: [{ name: a }, { name: x, propertyName: b}]} - export interface ImportClause extends Node { - defaultBinding?: Identifier; + // import d from "mod" => name = d, namedBinding = undefined + // import * as ns from "mod" => name = undefined, namedBinding: NamespaceImport = { name: ns } + // import d, * as ns from "mod" => name = d, namedBinding: NamespaceImport = { name: ns } + // import { a, b as x } from "mod" => name = undefined, namedBinding: NamedImports = { elements: [{ name: a }, { name: x, propertyName: b}]} + // import d, { a, b as x } from "mod" => name = d, namedBinding: NamedImports = { elements: [{ name: a }, { name: x, propertyName: b}]} + export interface ImportClause extends Declaration { + name?: Identifier; // Default binding namedBindings?: NamespaceImport | NamedImports; }