Attempting to incorporate an HTML template into a TypeScript component is resulting in an error for me. This is being done in Angular 1.5.
This is how the component appears...
import * as template from './home.template.html';
import { HomeController } from './home.controller';
export const HomeComponent = {
bindings: {
conf: '<',
},
controller: HomeController,
template,
};
The module includes this component like so...
import * as angular from 'angular';
import { HomeComponent } from './home.component';
export const HomeModule = angular.module('home', [])
.component('home', HomeComponent);
The error message I am encountering is...
Argument of type '{ bindings: { conf: string;}; controller: typeof HomeCon...' is not assignable to parameter of type 'IComponentOptions'. Types of property 'template' are incompatible.. Type 'typeof '.html'' is not assignable to type 'string | ((...args: any[]) => string) | (string | ((...args: any[]) => string))[]'. Type 'typeof '.html'' is not assignable to type '(string | ((...args: any[]) => string))[]'. Property 'find' is missing in type 'typeof '*.html''.
When I include template: template.toString()
within the HomeComponent, it seems to resolve the issue. However, this solution doesn't sit well with me. Any other suggestions?