dsherret / dsherret/ts-morph

Type#getTypeArguments() weird behaviour

Open
#631 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
6.2k
Forks
238
Avg merge
2m
Merged PRs (30d)
1

Description

Version: 2.2.0

**Overview**

Type#getTypeArguments()
returns first subclass as instance of TypeParameter
At least when it was got as ClassDeclaration#getExtends().getType()

**Sampe **

```ts

//file Parent.ts
export class Parent {

}

//file Child.ts

import { Parent } from "./Parent"
class Child extends Parent {
}

// file Plugin.ts
const project = new Project();
const sf = project.getSourceFile("Child.ts");

const ta = sf.getClasses()[0].getExtends().getType().getTypeArguments();

console.assert(ta.length === 0, "Something weird :( ");
```

**Expected behavior**
Seems like it shouldn't return any type arguments

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.