filestack / filestack-js

Official Javascript SDK for the Filestack API and content ingestion system.

Home Page:https://www.filestack.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

"fromSources" with typescript only accept string array, how to add a custom source?

jdupont22 opened this issue · comments

I'm using typescript, but the 'fromSources' definition is the following

` /**

  • Valid sources are:
    • local_file_system - Default
    • url - Default
    • imagesearch - Default
    • facebook - Default
    • instagram - Default
    • googledrive - Default
    • dropbox - Default
    • webcam - Uses device menu on mobile. Not currently supported in Safari and IE.
    • video - Uses device menu on mobile. Not currently supported in Safari and IE.
    • audio - Uses device menu on mobile. Not currently supported in Safari and IE.
    • box
    • github
    • gmail
    • googlephotos
    • onedrive
    • onedriveforbusiness
    • customsource - Configure this in your Filestack Dev Portal.
    • unsplash
      */
      fromSources?: string[];`

How can I put a custom source, that is defined as an object?

Expected Behavior

Provide a Typescript type for the 'custom source' and update 'fromSources' to accept both string and this new type.

Current Behavior

Only string accepted, i can't put my custom source with Typescript

Possible Solution

Steps to Reproduce (for bugs)

I try to use the exemple in the Filestack tutorial for custom source, with Typescript

Additional Screenshots

Capture d’écran 2022-12-16 à 15 06 20

Context

Your Environment

  • Version used: 3.25.0
  • Browser Name and version: any
  • Operating System and version (desktop or mobile): any
  • Link to your project:
  • Typescript

-- EDIT --
When I force the type to "string" with "myCustomSource as unknown as string" it's working.
But, it's clearly a workaround, waiting to the "fromSources" type to be enhanced.