Skip to content

Commit 58fc6e1

Browse files
committed
fix: do not include this argument when generating signature of a FunctionType
[converter][web] Fix #118
1 parent 98d1bd2 commit 58fc6e1

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/Glutinum.Converter/Transform.fs

+3
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,9 @@ let rec private transformType
437437
({
438438
Parameters =
439439
functionTypeInfo.Parameters
440+
// TypeScript allows to annotate the `this` parameter but it is not actually part
441+
// of the function signature that the user will call.
442+
|> List.filter (fun parameter -> parameter.Name <> "this")
440443
|> List.map (transformParameter context)
441444
ReturnType = transformType context functionTypeInfo.Type
442445
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
interface Database {
2+
run(sql: string, callback?: (this: string, err: Error | null) => void): this;
3+
}

0 commit comments

Comments
 (0)