chore: Make field declarations explicit
This used to be valid code:
```
class Foo {
constructor() {
this.bar = ‘string’;
}
}
```
This will now fail since ‘bar’ is not explicitly
defined as a field. We now have to write:
```
class Foo {
bar:string; // << REQUIRED
constructor() {
this.bar = ‘string’;
}
}
```
This commit is contained in:
@@ -0,0 +1,115 @@
|
||||
import {ABSTRACT, CONST, normalizeBlank} from 'facade/lang';
|
||||
import {List} from 'facade/collection';
|
||||
import {TemplateConfig} from './template_config';
|
||||
|
||||
|
||||
@ABSTRACT()
|
||||
export class Directive {
|
||||
selector:any; //string;
|
||||
bind:any;
|
||||
lightDomServices:any; //List;
|
||||
implementsTypes:any; //List;
|
||||
@CONST()
|
||||
constructor({
|
||||
selector,
|
||||
bind,
|
||||
lightDomServices,
|
||||
implementsTypes
|
||||
}:{
|
||||
selector:string,
|
||||
bind:any,
|
||||
lightDomServices:List,
|
||||
implementsTypes:List
|
||||
}={})
|
||||
{
|
||||
this.selector = selector;
|
||||
this.lightDomServices = lightDomServices;
|
||||
this.implementsTypes = implementsTypes;
|
||||
this.bind = bind;
|
||||
}
|
||||
}
|
||||
|
||||
export class Component extends Directive {
|
||||
//TODO: vsavkin: uncomment it once the issue with defining fields in a sublass works
|
||||
template:any; //TemplateConfig;
|
||||
lightDomServices:any; //List;
|
||||
shadowDomServices:any; //List;
|
||||
componentServices:any; //List;
|
||||
|
||||
@CONST()
|
||||
constructor({
|
||||
selector,
|
||||
bind,
|
||||
template,
|
||||
lightDomServices,
|
||||
shadowDomServices,
|
||||
componentServices,
|
||||
implementsTypes
|
||||
}:{
|
||||
selector:String,
|
||||
bind:Object,
|
||||
template:TemplateConfig,
|
||||
lightDomServices:List,
|
||||
shadowDomServices:List,
|
||||
componentServices:List,
|
||||
implementsTypes:List
|
||||
}={})
|
||||
{
|
||||
super({
|
||||
selector: selector,
|
||||
bind: bind,
|
||||
lightDomServices: lightDomServices,
|
||||
implementsTypes: implementsTypes});
|
||||
|
||||
this.template = template;
|
||||
this.lightDomServices = lightDomServices;
|
||||
this.shadowDomServices = shadowDomServices;
|
||||
this.componentServices = componentServices;
|
||||
}
|
||||
}
|
||||
|
||||
export class Decorator extends Directive {
|
||||
@CONST()
|
||||
constructor({
|
||||
selector,
|
||||
bind,
|
||||
lightDomServices,
|
||||
implementsTypes
|
||||
}:{
|
||||
selector:string,
|
||||
bind:any,
|
||||
lightDomServices:List,
|
||||
implementsTypes:List
|
||||
}={})
|
||||
{
|
||||
super({
|
||||
selector: selector,
|
||||
bind: bind,
|
||||
lightDomServices: lightDomServices,
|
||||
implementsTypes: implementsTypes
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export class Template extends Directive {
|
||||
@CONST()
|
||||
constructor({
|
||||
selector,
|
||||
bind,
|
||||
lightDomServices,
|
||||
implementsTypes
|
||||
}:{
|
||||
selector:string,
|
||||
bind:any,
|
||||
lightDomServices:List,
|
||||
implementsTypes:List
|
||||
}={})
|
||||
{
|
||||
super({
|
||||
selector: selector,
|
||||
bind: bind,
|
||||
lightDomServices: lightDomServices,
|
||||
implementsTypes: implementsTypes
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
import {Directive} from './directive';
|
||||
import {CONST} from 'facade/lang';
|
||||
|
||||
export class Component extends Directive {
|
||||
@CONST()
|
||||
constructor({
|
||||
selector,
|
||||
bind,
|
||||
template,
|
||||
lightDomServices,
|
||||
shadowDomServices,
|
||||
componentServices,
|
||||
implementsTypes
|
||||
}:{
|
||||
selector:String,
|
||||
bind:Object,
|
||||
template:TemplateConfig,
|
||||
lightDomServices:List,
|
||||
shadowDomServices:List,
|
||||
componentServices:List,
|
||||
implementsTypes:List
|
||||
}={})
|
||||
{
|
||||
super({
|
||||
selector: selector,
|
||||
bind: bind,
|
||||
lightDomServices: lightDomServices,
|
||||
implementsTypes: implementsTypes});
|
||||
this.template = template;
|
||||
this.lightDomServices = lightDomServices;
|
||||
this.shadowDomServices = shadowDomServices;
|
||||
this.componentServices = componentServices;
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////
|
||||
/*
|
||||
import 'package:angular/core.dart' as core;
|
||||
|
||||
|
||||
@Component(
|
||||
selector: 'example',
|
||||
template: const TemplateConfig(
|
||||
url: 'example.dart',
|
||||
uses: const [core.CONFIG],
|
||||
directives: const [CompA],
|
||||
formatters: const [Stringify]
|
||||
),
|
||||
componentServices: [...],
|
||||
shadowDomServices: [...]
|
||||
implementsTypes: const [App]
|
||||
)
|
||||
class Example implements App {}
|
||||
|
||||
class CompA {}
|
||||
|
||||
@Formatter()
|
||||
class Stringify {}
|
||||
|
||||
<CompA>
|
||||
LightDOM:
|
||||
</CompA>
|
||||
|
||||
CompA ShadowDOM:
|
||||
<div>
|
||||
<CompB></CompB>
|
||||
</div>
|
||||
|
||||
CompB SHadowDOM:
|
||||
<div></div>
|
||||
*/
|
||||
@@ -1,25 +0,0 @@
|
||||
import {Directive} from './directive';
|
||||
import {CONST} from 'facade/lang';
|
||||
|
||||
export class Decorator extends Directive {
|
||||
@CONST()
|
||||
constructor({
|
||||
selector,
|
||||
bind,
|
||||
lightDomServices,
|
||||
implementsTypes
|
||||
}:{
|
||||
selector:String,
|
||||
bind:Object,
|
||||
lightDomServices:List,
|
||||
implementsTypes:List
|
||||
}={})
|
||||
{
|
||||
super({
|
||||
selector: selector,
|
||||
bind: bind,
|
||||
lightDomServices: lightDomServices,
|
||||
implementsTypes: implementsTypes
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
import {ABSTRACT, CONST} from 'facade/lang';
|
||||
import {List} from 'facade/collection';
|
||||
|
||||
|
||||
@ABSTRACT()
|
||||
export class Directive {
|
||||
@CONST()
|
||||
constructor({
|
||||
selector,
|
||||
bind,
|
||||
lightDomServices,
|
||||
implementsTypes
|
||||
}:{
|
||||
selector:String,
|
||||
bind:Object,
|
||||
lightDomServices:List,
|
||||
implementsTypes:List
|
||||
}={})
|
||||
{
|
||||
this.selector = selector;
|
||||
this.lightDomServices = lightDomServices;
|
||||
this.implementsTypes = implementsTypes;
|
||||
this.bind = bind;
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
import {Directive} from './directive';
|
||||
import {CONST} from 'facade/lang';
|
||||
|
||||
export class Template extends Directive {
|
||||
@CONST()
|
||||
constructor({
|
||||
selector,
|
||||
bind,
|
||||
lightDomServices,
|
||||
implementsTypes
|
||||
}:{
|
||||
selector:String,
|
||||
bind:Object,
|
||||
lightDomServices:List,
|
||||
implementsTypes:List
|
||||
}={})
|
||||
{
|
||||
super({
|
||||
selector: selector,
|
||||
bind: bind,
|
||||
lightDomServices: lightDomServices,
|
||||
implementsTypes: implementsTypes
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,12 @@
|
||||
import {ABSTRACT, CONST} from 'facade/lang';
|
||||
// import {Type, List} from 'facade/lang';
|
||||
import {ABSTRACT, CONST, Type} from 'facade/lang';
|
||||
import {List} from 'facade/collection';
|
||||
|
||||
export class TemplateConfig {
|
||||
url:any; //string;
|
||||
inline:any; //string;
|
||||
directives:any; //List<Type>;
|
||||
formatters:any; //List<Type>;
|
||||
source:any;//List<TemplateConfig>;
|
||||
@CONST()
|
||||
constructor({
|
||||
url,
|
||||
@@ -10,8 +15,8 @@ export class TemplateConfig {
|
||||
formatters,
|
||||
source
|
||||
}: {
|
||||
url: String,
|
||||
inline: String,
|
||||
url: string,
|
||||
inline: string,
|
||||
directives: List<Type>,
|
||||
formatters: List<Type>,
|
||||
source: List<TemplateConfig>
|
||||
|
||||
Reference in New Issue
Block a user