-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add undefined type and identifier to some types
- Loading branch information
1 parent
01f00d7
commit cdcef7d
Showing
15 changed files
with
103 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,17 @@ | ||
import { IntersectionTypeNode } from "typescript"; | ||
import { IntersectionType } from "./IntersectionType"; | ||
import { DeclarationMeta } from "../parser"; | ||
import { TypeDeclaration } from "./TypeDeclaration"; | ||
|
||
import { IntersectionTypeNode } from "typescript" | ||
import { IntersectionType } from "./IntersectionType" | ||
import { DeclarationMeta } from "../parser" | ||
import { TypeDeclaration } from "./TypeDeclaration" | ||
|
||
export class IntersectionTypeDeclaration extends TypeDeclaration { | ||
public type: IntersectionType; | ||
public type: IntersectionType | ||
|
||
constructor(meta: DeclarationMeta, node: IntersectionTypeNode) { | ||
super(meta); | ||
this.type = new IntersectionType(node); | ||
super(meta) | ||
this.type = new IntersectionType(node, this.identifier) | ||
} | ||
|
||
typeToString(): string { | ||
return this.type.toString(); | ||
return this.type.toString() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,15 @@ | ||
import { DeclarationMeta } from "../parser"; | ||
import { TypeDeclaration } from "./TypeDeclaration"; | ||
import { StringType } from "./StringType"; | ||
|
||
import { DeclarationMeta } from "../parser" | ||
import { TypeDeclaration } from "./TypeDeclaration" | ||
import { StringType } from "./StringType" | ||
|
||
export class StringTypeDeclaration extends TypeDeclaration { | ||
public type: StringType = new StringType(); | ||
public type: StringType = new StringType(this.identifier) | ||
|
||
constructor(meta: DeclarationMeta) { | ||
super(meta); | ||
super(meta) | ||
} | ||
|
||
typeToString(): string { | ||
return "string"; | ||
return "string" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { Type } from "./Type" | ||
|
||
export class UndefinedType extends Type { | ||
toString() { | ||
return "undefined" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,17 @@ | ||
import { UnionTypeNode } from "typescript"; | ||
import { UnionType } from "./UnionType"; | ||
import { DeclarationMeta } from "../parser"; | ||
import { TypeDeclaration } from "./TypeDeclaration"; | ||
|
||
import { UnionTypeNode } from "typescript" | ||
import { UnionType } from "./UnionType" | ||
import { DeclarationMeta } from "../parser" | ||
import { TypeDeclaration } from "./TypeDeclaration" | ||
|
||
export class UnionTypeDeclaration extends TypeDeclaration { | ||
public type: UnionType; | ||
public type: UnionType | ||
|
||
constructor(meta: DeclarationMeta, node: UnionTypeNode) { | ||
super(meta); | ||
this.type = new UnionType(node); | ||
super(meta) | ||
this.type = new UnionType(node, this.identifier) | ||
} | ||
|
||
typeToString(): string { | ||
return this.type.toString(); | ||
return this.type.toString() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { KeywordTypeNode, SyntaxKind, TypeNode } from "typescript" | ||
|
||
export function isUndefinedKeywordTypeNode(node: TypeNode): node is KeywordTypeNode<SyntaxKind.UndefinedKeyword> { | ||
return node.kind === SyntaxKind.UndefinedKeyword | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters