sst / ion

❍ — a new engine for SST
https://ion.sst.dev
MIT License
948 stars 98 forks source link

`sst dev` doesn't generate all types to `.sst/types.generated.ts` in sst >=0.0.319 #415

Closed eriks-studio closed 1 week ago

eriks-studio commented 2 weeks ago

Description

Example

With this sst.config.ts:

/// <reference path="./.sst/platform/config.d.ts" />

export default $config({
    app(input) {
        return {
            name: 'sst-typegen-test',
            removal: input?.stage === 'production' ? 'retain' : 'remove',
            home: 'aws',
        };
    },
    async run() {
        const bucket = new sst.aws.Bucket('TestBucket');

        const func = new sst.aws.Function('TestFunction', {
            handler: 'index.handler',
            link: [bucket],
        });
    },
});

In sst >=0.0.319 sst dev generates this:

/* tslint:disable */
/* eslint-disable */
import "sst"
declare module "sst" {
  export interface Resource {
    TestBucket: {
      name: string
      type: "sst.aws.Bucket"
    }
  }
}
export {}

Whereas in sst <=0.0.318 sst dev generates this:

import "sst"
declare module "sst" {
  export interface Resource {
    TestFunction: {
      name: string
      type: "sst.aws.Function"
    }
    TestBucket: {
      name: string
      type: "sst.aws.Bucket"
    }
  }
}
export {}

References

thdxr commented 1 week ago

the issue was it did not generate links for resources that weren't linked, fixed in v0.0.383