Prisma1: Allow Writing Functions in ES7+

Created on 5 Jun 2017  路  9Comments  路  Source: prisma/prisma1

It would be really great if you could allow writing functions in ES7+, since graphcool is mainly for frontend engineers, being able to use a normal export default and object destructuring and even stage0 features like object-rest-spread-operator would be really nice, and should just be a babel compile step for you away.

I was expecting to be able to write something like this:

export default function ({ data }) {
  const slug = data.title.toLowerCase().replace(' ', '-')
  return { data: { ...data, slug } }
}

Most helpful comment

Spread operator is already supported with 'use latest'

All 9 comments

Also async/await...

I cannot imagine going back to writing chains of then().

async/await is even supported by recent node releases, so there's really not that much to compile down. Mainly object-rest-spread is missing, which is something, I got very used to since react enables it by default.

Huge +1. I think it would be great to be able to choose version of ES. Note sure how does it look on your side. But why not just compile code via babel on every save/try like https://babeljs.io/repl/ does.

Personally, I would almost prefer if graphcool would just respect .nvmrc to pick NodeJS version and don't provide any kind of transpilation on its own. That way we would know what to expect there instead of relying on some specific setup.

Any update on this? Especially using the spread operator? 馃憤

Spread operator is already supported with 'use latest'

ES7 + TypeScript support is now there since version 0.7 of the Framework Preview: https://github.com/graphcool/graphcool/releases/tag/0.7

That's not ES7 support, that's babel.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

akoenig picture akoenig  路  3Comments

marktani picture marktani  路  3Comments

schickling picture schickling  路  3Comments

schickling picture schickling  路  3Comments

Fi1osof picture Fi1osof  路  3Comments