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

Support Typing in ViewOnly Templates? #399

Closed
MeirionHughes opened this issue Jun 21, 2016 · 1 comment
Closed

Support Typing in ViewOnly Templates? #399

MeirionHughes opened this issue Jun 21, 2016 · 1 comment

Comments

@MeirionHughes
Copy link
Contributor

MeirionHughes commented Jun 21, 2016

Will Aurelia support typing of variables created in View-Only Templates?

I'm currently flirting with the idea of doing something like, one of these:

<require symbols="{Item}" from="./path/to/item"></import>
<require symbols="{Foo}" from="./foo"></import>
<template bindable="items:Item[], foo:Foo" >
   <table>
    <tr repeat.for="item of items">
      <td>${item.address.knock().result}</td>
    </tr>
  </table>
<template> 
<template symbols="{Item}" from="./path/to/item"  bindable="items:Item[]">
     ...
<template symbols="{Item}, {Foo}" from="./path/to/item,./foo"  bindable="items:Item[], foo:Foo">
     ...
<template bindable="items:Item[], foo:Foo" >
    <require symbols="{Item}" from="./path/to/item"></import>
    <require symbols="{Foo}" from="./foo"></import>
<!-- reference symbols="{Item}" path="./path/to/item" -->
<!-- reference symbols="{Foo}" path="foo" -->
<template bindable="items:Item[], foo:Foo" >
    ...

I could quite easily then lint this and check type usage is correct at build time.

Having the require inside the the template is a little more difficult for me to because the linter currently doesn't look ahead; it analysis based on previous state changes.

Now I technically could just simply do any of these above, then strip out the extra html, as a gulp task, and you'd be left with

<template bindable="items, foo">
     ...

However, I would prefer to come to a consensus on how you'd want to do it. Then have aurelia deal with the syntax even if that means ignoring it for the foreseeable future.

@EisenbergEffect
Copy link
Contributor

I don't think we're going to add tyings into the html templates.

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

No branches or pull requests

2 participants