Skip to content

Commit b252539

Browse files
committed
fix(.d.ts): correct ComponentAnnotation inheritance
Closes angular#2356
1 parent cf3051a commit b252539

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

docs/dgeni-package/templates/angular2/angular2.d.ts.template.html

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
interface List<T> extends Array<T> {}
1010
interface Map<K,V> {}
1111
interface StringMap<K,V> extends Map<K,V> {}
12-
declare type Type = ng.Type;
1312

1413
declare module ng {
1514
type SetterFn = typeof Function;

docs/dgeni-package/templates/type-definition.template.html

+9-5
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,16 @@
1010

1111
{%- macro memberInfo(member, level) -%}
1212
{$ commentBlock(member, level) $}
13-
{$ member.name $}{% if member.optional %}?{% endif -%}
13+
{% if member.name == '__new' -%}
14+
new
15+
{%- elif member.name == '__call' -%}
16+
{%- else -%}
17+
{$ member.name $}
18+
{%- endif -%}{% if member.optional %}?{% endif -%}
1419
{% if member.typeParameters %}<{% for typeParam in member.typeParameters %}{$ typeParam $}{% if not loop.last %}, {% endif %}{% endfor %}>{% endif -%}
1520
{%- if member.parameters -%}({% for param in member.parameters %}{$ param $}{% if not loop.last %}, {% endif %}{% endfor %}){%- endif -%}
16-
{%- if member.returnType -%}
17-
: {$ member.returnType $}{%- else -%}: any
18-
{%- endif -%};
21+
{%- if member.returnType == 'Directive' %}: DirectiveAnnotation{%- elif member.returnType -%}: {$ member.returnType $}{%- else -%}: any{%- endif -%}
22+
;
1923
{%- endmacro -%}
2024

2125

@@ -38,7 +42,7 @@
3842
{%- if export.content -%}
3943
{$ commentBlock(export, 3) $}
4044
{%- endif %}
41-
{$ export.docType $} {$ export.name $}{$ export.typeParams $}{$ export.heritage $}
45+
{$ export.docType $} {$ export.name $}{$ export.typeParams $}{%- if export.heritage == ' extends Directive' %} extends DirectiveAnnotation{% else %}{$ export.heritage $}{% endif %}
4246
{%- if export.docType == 'class' or export.docType == 'interface' %} {
4347
{%- if export.newMember %}
4448
{$ memberInfo(export.newMember, 5) $}

modules/angular2/angular2.api.ts

+1-5
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,9 @@ export * from './angular2';
1111
// 1) if the symbol is intended to be part of the public API, then re-export somewhere else
1212
// 2) if the symbol should be omitted from the public API, then the class exposing it should
1313
// not be exported, or should avoid exposing the symbol.
14-
export {ProtoRecord, RecordType} from './src/change_detection/proto_record';
1514
export * from './src/core/compiler/element_injector';
1615
export {DependencyAnnotation} from './src/di/annotations_impl';
17-
// FIXME: this is a workaround for https://github.com/angular/angular/issues/2356
18-
// We export the Directive *annotation* instead of the *decorator*.
19-
// But it breaks the build.
20-
export {Directive, LifecycleEvent} from './src/core/annotations_impl/annotations';
16+
export {LifecycleEvent} from './src/core/annotations_impl/annotations';
2117
export {Form} from './src/forms/directives/form_interface';
2218
export {TypeDecorator, ClassDefinition} from './src/util/decorators';
2319
export {Query} from './src/core/annotations_impl/di';

0 commit comments

Comments
 (0)