Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 47bd4d3

Browse filesBrowse files
authored
Merge pull request microsoft#15531 from Microsoft/moreFactoryFuncs
More factory functions
2 parents abb2b82 + 981956a commit 47bd4d3
Copy full SHA for 47bd4d3

7 files changed

+588-511Lines changed: 588 additions & 511 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/compiler/checker.ts‎

Copy file name to clipboardExpand all lines: src/compiler/checker.ts
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2390,7 +2390,7 @@ namespace ts {
23902390
const formattedUnionTypes = formatUnionTypes((<UnionType>type).types);
23912391
const unionTypeNodes = formattedUnionTypes && mapToTypeNodeArray(formattedUnionTypes);
23922392
if (unionTypeNodes && unionTypeNodes.length > 0) {
2393-
return createUnionOrIntersectionTypeNode(SyntaxKind.UnionType, unionTypeNodes);
2393+
return createUnionTypeNode(unionTypeNodes);
23942394
}
23952395
else {
23962396
if (!context.encounteredError && !(context.flags & NodeBuilderFlags.allowEmptyUnionOrIntersection)) {
@@ -2401,7 +2401,7 @@ namespace ts {
24012401
}
24022402

24032403
if (type.flags & TypeFlags.Intersection) {
2404-
return createUnionOrIntersectionTypeNode(SyntaxKind.IntersectionType, mapToTypeNodeArray((type as UnionType).types));
2404+
return createIntersectionTypeNode(mapToTypeNodeArray((type as IntersectionType).types));
24052405
}
24062406

24072407
if (objectFlags & (ObjectFlags.Anonymous | ObjectFlags.Mapped)) {
@@ -2661,7 +2661,7 @@ namespace ts {
26612661
indexerTypeNode,
26622662
/*initializer*/ undefined);
26632663
const typeNode = typeToTypeNodeHelper(indexInfo.type);
2664-
return createIndexSignatureDeclaration(
2664+
return createIndexSignature(
26652665
/*decorators*/ undefined,
26662666
indexInfo.isReadonly ? [createToken(SyntaxKind.ReadonlyKeyword)] : undefined,
26672667
[indexingParameter],
Collapse file

‎src/compiler/factory.ts‎

Copy file name to clipboardExpand all lines: src/compiler/factory.ts
+414-379Lines changed: 414 additions & 379 deletions
Large diffs are not rendered by default.
Collapse file

‎src/compiler/types.ts‎

Copy file name to clipboardExpand all lines: src/compiler/types.ts
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1506,7 +1506,7 @@ namespace ts {
15061506
// for the same reasons we treat NewExpression as a PrimaryExpression.
15071507
export interface MetaProperty extends PrimaryExpression {
15081508
kind: SyntaxKind.MetaProperty;
1509-
keywordToken: SyntaxKind;
1509+
keywordToken: SyntaxKind.NewKeyword;
15101510
name: Identifier;
15111511
}
15121512

Collapse file

‎src/compiler/utilities.ts‎

Copy file name to clipboardExpand all lines: src/compiler/utilities.ts
+12-1Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3650,7 +3650,18 @@ namespace ts {
36503650
|| kind === SyntaxKind.GetAccessor
36513651
|| kind === SyntaxKind.SetAccessor
36523652
|| kind === SyntaxKind.IndexSignature
3653-
|| kind === SyntaxKind.SemicolonClassElement;
3653+
|| kind === SyntaxKind.SemicolonClassElement
3654+
|| kind === SyntaxKind.MissingDeclaration;
3655+
}
3656+
3657+
export function isTypeElement(node: Node): node is TypeElement {
3658+
const kind = node.kind;
3659+
return kind === SyntaxKind.ConstructSignature
3660+
|| kind === SyntaxKind.CallSignature
3661+
|| kind === SyntaxKind.PropertySignature
3662+
|| kind === SyntaxKind.MethodSignature
3663+
|| kind === SyntaxKind.IndexSignature
3664+
|| kind === SyntaxKind.MissingDeclaration;
36543665
}
36553666

36563667
export function isObjectLiteralElementLike(node: Node): node is ObjectLiteralElementLike {
Collapse file

‎src/compiler/visitor.ts‎

Copy file name to clipboardExpand all lines: src/compiler/visitor.ts
+149-118Lines changed: 149 additions & 118 deletions
Large diffs are not rendered by default.
Collapse file

‎src/services/codefixes/fixAddMissingMember.ts‎

Copy file name to clipboardExpand all lines: src/services/codefixes/fixAddMissingMember.ts
+8-8Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -110,16 +110,16 @@ namespace ts.codefix {
110110
if (!isStatic) {
111111
const stringTypeNode = createKeywordTypeNode(SyntaxKind.StringKeyword);
112112
const indexingParameter = createParameter(
113-
/*decorators*/ undefined,
114-
/*modifiers*/ undefined,
115-
/*dotDotDotToken*/ undefined,
113+
/*decorators*/ undefined,
114+
/*modifiers*/ undefined,
115+
/*dotDotDotToken*/ undefined,
116116
"x",
117-
/*questionToken*/ undefined,
117+
/*questionToken*/ undefined,
118118
stringTypeNode,
119-
/*initializer*/ undefined);
120-
const indexSignature = createIndexSignatureDeclaration(
121-
/*decorators*/ undefined,
122-
/*modifiers*/ undefined,
119+
/*initializer*/ undefined);
120+
const indexSignature = createIndexSignature(
121+
/*decorators*/ undefined,
122+
/*modifiers*/ undefined,
123123
[indexingParameter],
124124
typeNode);
125125

Collapse file

‎src/services/codefixes/helpers.ts‎

Copy file name to clipboardExpand all lines: src/services/codefixes/helpers.ts
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ namespace ts.codefix {
200200
}
201201

202202
export function createStubbedMethod(modifiers: Modifier[], name: PropertyName, optional: boolean, typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], returnType: TypeNode | undefined) {
203-
return createMethodDeclaration(
203+
return createMethod(
204204
/*decorators*/ undefined,
205205
modifiers,
206206
/*asteriskToken*/ undefined,

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.