Skip to content

[v3] Method binding is converted from the time.Time type to its own Time type #4753

@mtgto

Description

@mtgto

Description

Hi. I am using wails v3-alpha41.
When we created a Go language service with a method that returns the time.Time type, the TypeScript code generated by Wails' Method binding generated its own Time type instead of the Date type.

My understanding is that the time.Time type of Go is converted to the Date type in TypeScript.
https://v3alpha.wails.io/features/bindings/methods/#complex-types

Here are generated codes

greetservice.go

package main

import "time"

type GreetService struct{}

func (g *GreetService) GetTime() time.Time {
	return time.Now()
}

frontend/bindings/changeme/greetservice.ts (Generated)

// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore: Unused imports
import { Call as $Call, CancellablePromise as $CancellablePromise, Create as $Create } from "@wailsio/runtime";

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore: Unused imports
import * as time$0 from "../time/models.js";

export function GetTime(): $CancellablePromise<time$0.Time> {
    return $Call.ByID(570467169);
}

frontend/bindings/time/models.ts (Generated)

export type Time = any;

To Reproduce

Upload example project to https://github.com/mtgto/example-wails3-vanilla-ts

Expected behaviour

The return value of the generated method is the Date type

Screenshots

No response

Attempted Fixes

No response

System Details

❯ wails3 doctor
 Wails (v3.0.0-alpha.41)  Wails Doctor

# System

┌──────────────────────────────────────────────────┐
| Name          | MacOS                            |
| Version       | 26.1                             |
| ID            | 25B78                            |
| Branding      | MacOS 26.1                       |
| Platform      | darwin                           |
| Architecture  | arm64                            |
| Apple Silicon | true                             |
| CPU           | Apple M2 Pro                     |
| CPU 1         | Apple M2 Pro                     |
| CPU 2         | Apple M2 Pro                     |
| GPU           | 16 cores, Metal Support: Metal 4 |
| Memory        | 32 GB                            |
└──────────────────────────────────────────────────┘

# Build Environment

┌─────────────────────────────────────────────────────────────────────────────────────────────────────┐
| Wails CLI      | v3.0.0-alpha.41                                                                    |
| Go Version     | go1.25.4                                                                           |
| -buildmode     | exe                                                                                |
| -compiler      | gc                                                                                 |
| CGO_CFLAGS     |                                                                                    |
| CGO_CPPFLAGS   |                                                                                    |
| CGO_CXXFLAGS   |                                                                                    |
| CGO_ENABLED    | 1                                                                                  |
| CGO_LDFLAGS    |                                                                                    |
| DefaultGODEBUG | containermaxprocs=0,decoratemappings=0,tlssha1=1,updatemaxprocs=0,x509sha256skid=0 |
| GOARCH         | arm64                                                                              |
| GOARM64        | v8.0                                                                               |
| GOOS           | darwin                                                                             |
└─────────────────────────────────────────────────────────────────────────────────────────────────────┘

# Dependencies

┌────────────────────────────────────────────────────────────────────────┐
| *NSIS           | Not Installed. Install with `brew install makensis`. |
| Xcode cli tools | 2416                                                 |
| npm             | 10.9.2                                               |
|                                                                        |
└─────────────────────── * - Optional Dependency ────────────────────────┘

# Checking for issues

 SUCCESS  No issues found

# Diagnosis

 SUCCESS  Your system is ready for Wails development!

Need documentation? Run: wails3 docs
 ♥   If Wails is useful to you or your company, please consider sponsoring the project: wails3 sponsor

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions