google / google/closure-compiler

Could not resolve type in @extends tag

Open
#1,673 6 comments 0 reactions 0 assignees View on GitHub
P3 Types
Dominant language
JavaScript
Stars
7.7k
Forks
1.2k
Avg merge
2d 12h
Merged PRs (30d)
6

Description

[Question on StackOverflow](http://stackoverflow.com/questions/36103312/closure-compiler-could-not-resolve-type-in-extends-tag)

There is a warning when I compile this code using interfaces

``` js
/**
* @interface
* @extends {IReused}
*/
function IRegistration() {
}

/**
* @interface
*/
function IInitializable() {
}

/**
* @param {IReused} initializer
*/
IInitializable.prototype.initializedBy = function (initializer) { };

/**
* @interface
* @extends {IOwned}
*/
function IReused() {
}

/**
* @interface
*/
function IOwned() {
}
```

But when I change all interfaces to classes everything just works.

``` js
/**
* @constructor
* @extends {IReused}
*/
function IRegistration() {
}

/**
* @constructor
*/
function IInitializable() {
}

/**
* @param {IReused} initializer
*/
IInitializable.prototype.initializedBy = function (initializer) { };

/**
* @constructor
* @extends {IOwned}
*/
function IReused() {
}

/**
* @constructor
*/
function IOwned() {
}
```

Also when using interfaces when I remove the `IReused` parameter from the `initializedBy` function everything works as expected.

I've also noticed that if I change the order of the interfaces the compiler does not output a warning

``` js
/**
* @interface
*/
function IOwned() {
}

/**
* @interface
* @extends {IOwned}
*/
function IReused() {
}

/**
* @interface
* @extends {IReused}
*/
function IRegistration() {
}

/**
* @interface
*/
function IInitializable() {
}

/**
* @param {IReused} initializer
*/
IInitializable.prototype.initializedBy = function (initializer) { };
```

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.