microsoft / TypeScript

TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
https://www.typescriptlang.org
Apache License 2.0
100.84k stars 12.46k forks source link

Function requiring IVector<string> does not accept string array #5717

Closed wwrafter closed 8 years ago

wwrafter commented 8 years ago

In a Windows 10 Universal app, I'm trying to use the FileSavePicker to select a file. I am using Typescript. The insert method takes two parameters, a string and an IVector. The following code is from the MS website, but it is just straight javascript.

savePicker.fileTypeChoices.insert("Word Document", [".docx"]);

The error text is, "Argument of type string[] is not assignable to parameter of type IVector". I have been able to get it to work using this:

var tempVec: Windows.Foundation.Collections.IVector; tempVec.append(".docx"); savePicker.fileTypeChoices.insert("Word Document", tempVec);

That seems unreasonably verbose. Is there a better syntax for accomplishing this?

http://stackoverflow.com/questions/33792978/how-to-pass-ivectorstring-in-typescript

mhegazy commented 8 years ago

I am assuming you are using winjs.d.ts from definitelytyped. this bug should go to https://github.com/DefinitelyTyped/DefinitelyTyped/