Skip to content

Use Promise<T> instead of PromiseLike<T> #193

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

Merged
merged 1 commit into from
Feb 14, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 8 additions & 10 deletions TS.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ module Types =

member this.Printl content =
Printf.kprintf (fun s -> output.Append("\r\n" + this.GetCurIndent() + s) |> ignore) content

member this.PrintlToStack content =
Printf.kprintf (fun s -> stack.Append("\r\n" + this.GetCurIndent() + s) |> ignore) content

member this.StackIsEmpty () = stack.Length = 0

member this.IncreaseIndent() = curTabCount <- curTabCount + 1
Expand Down Expand Up @@ -324,8 +324,8 @@ module Data =

type KnownWorkerInterfaceType = JsonProvider<"inputfiles/knownWorkerInterfaces.json", InferTypesFromValues=false>
let knownWorkerInterfaces =
File.ReadAllText(Path.Combine(GlobalVars.inputFolder, "knownWorkerInterfaces.json"))
|> KnownWorkerInterfaceType.Parse
File.ReadAllText(Path.Combine(GlobalVars.inputFolder, "knownWorkerInterfaces.json"))
|> KnownWorkerInterfaceType.Parse
|> set

let GetAllInterfacesByFlavor flavor =
Expand Down Expand Up @@ -736,8 +736,6 @@ module Emit =
let tName = DomTypeToTsType (genericMatch.Groups.[1].Value)
let paramName = DomTypeToTsType (genericMatch.Groups.[2].Value)
match tName with
| "Promise" ->
"PromiseLike<" + paramName + ">"
| _ ->
if tName = "Array" then paramName + "[]"
else tName + "<" + paramName + ">"
Expand Down Expand Up @@ -894,7 +892,7 @@ module Emit =
| Some pollutor -> "this: " + pollutor.Name + ", "
| _ -> ""

let EmitProperties flavor prefix (emitScope: EmitScope) (i: Browser.Interface) (conflictedMembers: Set<string>) =
let EmitProperties flavor prefix (emitScope: EmitScope) (i: Browser.Interface) (conflictedMembers: Set<string>) =
let emitPropertyFromJson (p: InputJsonType.Root) =
let readOnlyModifier =
match p.Readonly with
Expand Down Expand Up @@ -1030,7 +1028,7 @@ module Emit =

/// Emit the properties and methods of a given interface
let EmitMembers flavor (prefix: string) (emitScope: EmitScope) (i:Browser.Interface) =
let conflictedMembers =
let conflictedMembers =
match Map.tryFind i.Name extendConflictsBaseTypes with
| Some conflict -> conflict.MemberNames
| _ -> []
Expand Down Expand Up @@ -1129,7 +1127,7 @@ module Emit =
match Map.tryFind iName extendConflictsBaseTypes with
| Some _ -> iName + "Base"
| _ -> iName

let processedIName = processIName i.Name
if processedIName <> i.Name then
Pt.PrintlToStack "interface %s extends %s {" i.Name processedIName
Expand Down Expand Up @@ -1462,7 +1460,7 @@ module Emit =
Pt.Printl ""

EmitDictionaries flavor
browser.CallbackInterfaces.Interfaces |> Array.iter EmitCallBackInterface
browser.CallbackInterfaces.Interfaces |> Array.iter EmitCallBackInterface
EmitNonCallbackInterfaces flavor

// Add missed interface definition from the spec
Expand Down
Loading