Skip to content
Gx
GitHub

GX6001: island has no props struct

A TypeScript island has no props struct in its Go package.

Cause

A .ts file with a default export in a Go package is an island. The file name is the component name. The props of the island are the Go struct <Name>Props in the same package, and the package does not declare that struct.

Example

dashboard/charts.go
package dashboard

type Point struct {
	Month string `json:"month"`
	Total int    `json:"total"`
}
dashboard/RevenueChart.ts
export default (el: HTMLElement) => {
  el.textContent = "Revenue";
};

gx check reports:

gx check
dashboard/RevenueChart.ts:1:1: GX6001: island "RevenueChart" has no props struct "RevenueChartProps" in its Go package

Fix

  1. Declare type RevenueChartProps struct in a Go file of the same directory.
  2. Give each field a json tag. An island with no props has an empty struct.
  3. For a TypeScript file that is not a component, use a name that starts with a lower-case letter.