contentful-migrate icon indicating copy to clipboard operation
contentful-migrate copied to clipboard

Typescript compatible template

Open bgschiller opened this issue 3 years ago • 2 comments

This PR tries to be a happy middle-ground between https://github.com/deluan/contentful-migrate/issues/53 and https://github.com/deluan/contentful-migrate/pull/131. It's minimally invasive, but it's been working for me locally.

I also ran npm audit fix --force and verified that all the tests still pass.

bgschiller avatar May 16 '22 17:05 bgschiller

@bgschiller with this change, does that mean that migrations will still be javascript files, but the TS compiled will type-check it? Meaning: it will still be a .js file and I can't use types inside the migration.

luisrudge avatar Jun 29 '22 14:06 luisrudge

With this change:

  • migrations will still be javascript files
  • TS compiler will type-check it (including your editor, if you have that set up)
  • you can't use type annotation syntax inside the file (because it's still .js)
  • you can use JSDoc comments to annotate the types of values inside the migration file.

I find this is a pretty good balance of convenience and safety

bgschiller avatar Jun 29 '22 16:06 bgschiller