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

Argument of type '"long"' is not assignable to parameter of type 'duration'. #28

Closed
Taremeh opened this issue Apr 18, 2017 · 1 comment
Assignees
Labels

Comments

@Taremeh
Copy link

Taremeh commented Apr 18, 2017

Hi,
I tried to create a long Toast (as shown on the example page):
Toast.makeText("Hello World", "long").show();

However, I get an error, when compiling it:
error TS2345: Argument of type '"long"' is not assignable to parameter of type 'duration'.

I'm using Nativescript 2.5 (and newest TNS Android). I think there's something wrong with the declaration of the parameter 'duration'...

@jericdeleon
Copy link

jericdeleon commented Apr 25, 2017

Encountering this too

When trying
Toast.makeText("Hello World", Toast.duration.long).show();

...this runtime error shows up:
ERROR TypeError: Cannot read property 'long' of undefined

For now, I just edited nativescript-toast's index.d.ts to:
export function makeText(text: string, duration?: string): Toast;

I'm guessing duration's type is at fault as Typescript enums are number based (quoted here), so the duration argument should be changed either to constant strings or string-safe Typescript enums (manual example here ; npm package implementation here)

@hypery2k hypery2k self-assigned this Jul 13, 2017
@hypery2k hypery2k added the bug label Jul 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants