Property ‘value’ does not exist on type ‘EventTarget’

You need to explicitly tell TypeScript the type of the HTMLElement which is your target. The way to do it is using a generic type to cast it to a proper type: this.countUpdate.emit((<HTMLTextAreaElement>e.target).value./*…*/) or (as you like) this.countUpdate.emit((e.target as HTMLTextAreaElement).value./*…*/) or (again, matter of preference) const target = e.target as HTMLTextAreaElement; this.countUpdate.emit(target.value./*…*/) This will let … Read more

Import class in definition file (*d.ts)

After two years of TypeScript development, I’ve finally managed to solve this problem. Basically, TypeScript has two kind of module types declaration: “local” (normal modules) and ambient (global). The second kind allows to write global modules declaration that are merged with existing modules declaration. What are the differences between this files? d.ts files are treated … Read more

Angular4 – No value accessor for form control

You can use formControlName only on directives which implement ControlValueAccessor. Implement the interface So, in order to do what you want, you have to create a component which implements ControlValueAccessor, which means implementing the following three functions: writeValue (tells Angular how to write value from model into view) registerOnChange (registers a handler function that is … Read more