codesandbox-importers icon indicating copy to clipboard operation
codesandbox-importers copied to clipboard

`getParameters` method in define API requires file content to be a `string` in TypeScript

Open juliannaroen opened this issue 2 years ago • 3 comments

The getParameters method currently requires the value under content (which is a property of a file) to be a string: https://github.com/codesandbox/codesandbox-importers/blob/e68dcdd289c32045293db862b1897130a0825e0a/packages/import-utils/src/api/define.ts#L6

But in the docs, it's specified that content under package.json can be an object.

Either the documentation or the type signature on getParameters should be updated accordingly. I currently can't use an object in TS.

juliannaroen avatar Aug 19 '21 16:08 juliannaroen

I made a demo of how the package.json key could be typed in this TS playground.

juliannaroen avatar Aug 19 '21 16:08 juliannaroen

Thanks for opening the issue @juliannaroen! You're right, the docs are a bit wrong and we should update them. We're currently in the middle of rewriting the git importer into our Elixir server (instead of having it here as a standalone) and once we've done that we'll be completely rewriting some of the docs, especially the ones for the define endpoint.

In the meantime I'll try and make a small change to the docs to clarify what should be used now and let you know when I've done this. Hopefully next week.

sbinlondon avatar Aug 27 '21 10:08 sbinlondon

Any progress on the define endpoint docs @sbinlondon? Would a PR containing @juliannaroen's proposal be accepted?

gdostie avatar Nov 16 '22 15:11 gdostie