Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webpack + Angular2 require in template #571

Closed
galsch opened this issue May 7, 2016 · 2 comments
Closed

Webpack + Angular2 require in template #571

galsch opened this issue May 7, 2016 · 2 comments

Comments

@galsch
Copy link

galsch commented May 7, 2016

Hi,

I ran your project and everything works fine. However, when I did a more simplified version of Webpack + Angular2 I got the following problem:

When defining a component with requiring html template like this:

@component({
selector: 'test',
template: require('./test.component.html')
})

I get the following error:

Error:(22, 12) TS2345: Argument of type '{ selector: string; template: {}; directives: Type[][]; }' is not assignable to parameter of type '{ selector?: string; inputs?: string[]; outputs?: string[]; properties?: string[]; events?: strin...'.
Types of property 'template' are incompatible.
Type '{}' is not assignable to type 'string'.

I fix it by using:
@component({
selector: 'test',
template: "" + require('./test.component.html') + ""
})

In your project you have home.component.ts configured like this and it works without warning.

How did you solve this issue as it works perfectly without warning in your project?

Thanks

@PatrickJS
Copy link
Owner

I can't reproduce the error. Do you have a link to your setup?

@justme1
Copy link

justme1 commented May 20, 2016

Issue resolved can close issue:

microsoft/TypeScript#8514

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants