Skip to content

Commit

Permalink
refactor: remove completed todo comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mxsdev committed Oct 17, 2022
1 parent ded01c5 commit 7e2b808
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 10 deletions.
1 change: 0 additions & 1 deletion packages/api/src/localizedTree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,6 @@ function getChildren(info: ResolvedTypeInfo, { typeArguments: contextualTypeArgu
if(i < texts.length) {
const text = texts[i]
if(text) {
// TODO: this should probably be its own treenode type
res.push(
localize({ kind: 'string_literal', id: getEmptyTypeId(), value: text })
)
Expand Down
1 change: 0 additions & 1 deletion packages/api/src/tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ function _generateTypeTree({ symbol, type, node }: SymbolOrType, ctx: TypeTreeCo
else if(flags & ts.TypeFlags.NumberLiteral) { return { kind: 'number_literal', value: (type as ts.NumberLiteralType).value }}
else if(flags & ts.TypeFlags.BooleanLiteral) { return { kind: 'boolean_literal', value: (type as IntrinsicTypeInternal).intrinsicName === "true" }}
else if(flags & ts.TypeFlags.BigIntLiteral) { return { kind: 'bigint_literal', value: (type as ts.BigIntLiteralType).value }}
// TODO: add type param info
else if(flags & ts.TypeFlags.Object) {
const { symbol: typeSymbol } = type
if(typeSymbol && typeSymbol.flags & ts.SymbolFlags.Enum) {
Expand Down
2 changes: 0 additions & 2 deletions packages/api/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ export type TypeParameterInfo = {

export type TypeInfo = TypeInfoNoId & { id: TypeId }

// TODO: support ambient type parameters

export type TypeInfoNoId =
({
symbolMeta?: SymbolInfo,
Expand Down
12 changes: 7 additions & 5 deletions packages/api/src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,12 +253,14 @@ export function getEmptyTypeId(): TypeId {
return ""
}

// TODO: test for array type, tuple type
export function isPureObject(typeChecker: ts.TypeChecker, type: ts.Type): type is ts.ObjectType {
return (!!(type.flags & ts.TypeFlags.Object)
&& (getSignaturesOfType(typeChecker, type).length === 0)
&& (getIndexInfos(typeChecker, type).length === 0))
|| (!!(type.flags & ts.TypeFlags.Intersection) && (type as ts.IntersectionType).types.every(t => isPureObject(typeChecker, t)))
return (
!!(type.flags & ts.TypeFlags.Object)
&& (getSignaturesOfType(typeChecker, type).length === 0)
&& (getIndexInfos(typeChecker, type).length === 0)
&& !(isArrayType(type))
&& !(isTupleType(type))
) || (!!(type.flags & ts.TypeFlags.Intersection) && (type as ts.IntersectionType).types.every(t => isPureObject(typeChecker, t)))
}

export function getIntersectionTypesFlat(...types: ts.Type[]): ts.Type[] {
Expand Down
1 change: 0 additions & 1 deletion packages/typescript-explorer/src/view/typeTreeView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ const { None: NoChildren, Expanded, Collapsed } = vscode.TreeItemCollapsibleStat
export class TypeTreeProvider implements vscode.TreeDataProvider<TypeTreeItem> {
constructor(private stateManager: StateManager) { }

// private typeInfoMap: TypeInfoMap = new Map()
private typeInfoLocalizer: TypeInfoLocalizer|undefined

private _onDidChangeTreeData: vscode.EventEmitter<TypeTreeItem | undefined | null | void> = new vscode.EventEmitter<TypeTreeItem | undefined | null | void>()
Expand Down

0 comments on commit 7e2b808

Please sign in to comment.