What's Changed
- feat(BREAKING): TypeScript 6.0 by @dsherret in #1669
- feat: standalone
printStructurefunction by @dsherret in #1670 - fix:
InvalidOperationErrorinaddTypeArgumentby @jfirebaugh in #1663
Note there are some breaking changes due to TypeScript 6.0. Read more here: https://devblogs.microsoft.com/typescript/announcing-typescript-6-0/
As part of this release, structures can now be printed to a string using the printStructure function.
import { printStructure, StructureKind } from "ts-morph";
const code = printStructure({
kind: StructureKind.Class,
name: "MyClass",
isExported: true,
properties: [{ name: "myProp", type: "string" }],
methods: [{
name: "myMethod",
parameters: [{ name: "param", type: "number" }],
returnType: "void",
}],
});
console.log(code);Outputs:
export class MyClass {
myProp: string;
myMethod(param: number): void {
}
}New Contributors
- @jfirebaugh made their first contribution in #1663
Full Changelog: 27.0.2...28.0.0