`TypeMappings` usage
perkrlsn opened this issue · comments
Per Karlsson commented
Given the following simple example.
Input
packages:
- path: "types/src/test"
output_path: "src/types.ts"
type_mappings:
types.TestType: "number"
package types
type TestType string
Output
// Code generated by tygo. DO NOT EDIT.
//////////
// source: types.go
export type TestType = string;
Any help with the TypeMappings
feature would be appreciated.
Guido Zuidhof commented
Does the following work?
type_mappings:
TestType: "number"
The main idea behind the type mappings is to allow for specifying types that are from a different package, not to override types.
If it doesn't work, what you could do is exclude the file that contains type TestType string
, and rather use frontmatter to manually add the Typescript type you want to see.