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

Throw an error when a JavaScript templates returns non-Object from data #626

Closed
zachleat opened this issue Jul 25, 2019 · 1 comment
Closed
Assignees
Milestone

Comments

@zachleat
Copy link
Member

https://www.11ty.io/docs/languages/javascript/#optional-data-method

For example right now if you return a string a la:

class Test {
  data() {
    return "Ted";
  }
}

your data looks something like this

{"0":"T","1":"e","2":"d","page":{"date":"2019-07-25T13:31:57.085Z","inputPath":"./test/stubs/exports-flatdata.11ty.js","fileSlug":"exports-flatdata","url":"/exports-flatdata/","outputPath":"./dist/exports-flatdata/index.html"}}
@zachleat
Copy link
Member Author

Does anyone envision any problems if we enforce objects only when data resolves?

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

1 participant