Skip to content

Commit

Permalink
fix(typescript): Export namespace members that used to be exported by…
Browse files Browse the repository at this point in the history
… declared namespace (#5497)

fix(typescript): Export everything inside TS namespaces
  • Loading branch information
Swimburger authored Dec 27, 2024
1 parent 0af503e commit b679c79
Show file tree
Hide file tree
Showing 2,470 changed files with 3,854 additions and 3,819 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ export class GeneratedEndpointTypeSchemaImpl extends AbstractGeneratedEndpointTy
protected generateRawTypeDeclaration(context: ExpressContext, module: ModuleDeclaration): void {
module.addTypeAlias({
name: AbstractGeneratedSchema.RAW_TYPE_NAME,
type: getTextOfTsNode(context.typeSchema.getReferenceToRawType(this.type).typeNode)
type: getTextOfTsNode(context.typeSchema.getReferenceToRawType(this.type).typeNode),
isExported: true
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ export class GeneratedExpressErrorSchemaImpl
protected generateRawTypeDeclaration(context: ExpressContext, module: ModuleDeclaration): void {
module.addTypeAlias({
name: AbstractGeneratedSchema.RAW_TYPE_NAME,
type: getTextOfTsNode(context.typeSchema.getReferenceToRawType(this.type).typeNode)
type: getTextOfTsNode(context.typeSchema.getReferenceToRawType(this.type).typeNode),
isExported: true
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ export class GeneratedExpressInlinedRequestBodySchemaImpl
protected generateRawTypeDeclaration(context: ExpressContext, module: ModuleDeclaration): void {
module.addInterface({
name: AbstractGeneratedSchema.RAW_TYPE_NAME,
isExported: true,
properties: this.inlinedRequestBody.properties.map((property) => {
const type = context.typeSchema.getReferenceToRawType(property.valueType);
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import {
GetReferenceOpts,
getTextOfTsNode,
getWriterForMultiLineUnionType,
maybeAddDocsNode,
maybeAddDocsStructure
} from "@fern-typescript/commons";
import { BaseContext, GeneratedEnumType } from "@fern-typescript/contexts";
Expand Down Expand Up @@ -251,7 +250,8 @@ export class GeneratedEnumTypeImpl<Context extends BaseContext>
)
)
}
]
],
isExported: true
}
]
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ export class GeneratedAliasTypeSchemaImpl<Context extends ModelContext>
protected override generateRawTypeDeclaration(context: Context, module: ModuleDeclaration): void {
module.addTypeAlias({
name: AbstractGeneratedSchema.RAW_TYPE_NAME,
type: getTextOfTsNode(context.typeSchema.getReferenceToRawType(this.shape.aliasOf).typeNode)
type: getTextOfTsNode(context.typeSchema.getReferenceToRawType(this.shape.aliasOf).typeNode),
isExported: true
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ export class GeneratedEnumTypeSchemaImpl<Context extends BaseContext>
ts.factory.createLiteralTypeNode(ts.factory.createStringLiteral(value.name.wireValue))
)
)
)
),
isExported: true
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ export class GeneratedObjectTypeSchemaImpl<Context extends ModelContext>
}
]
: [])
]
],
isExported: true
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ export class GeneratedUndiscriminatedUnionTypeSchemaImpl<Context extends ModelCo
ts.factory.createUnionTypeNode(
this.shape.members.map((value) => context.typeSchema.getReferenceToRawType(value.type).typeNode)
)
)
),
isExported: true
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,8 @@ export class GeneratedUnionImpl<Context extends ModelContext> implements Generat
name: GeneratedUnionImpl.VISIT_UTIL_PROPERTY_NAME,
type: getTextOfTsNode(this.getVisitSignature(context))
}
]
],
isExported: true
};
}

Expand All @@ -383,7 +384,8 @@ export class GeneratedUnionImpl<Context extends ModelContext> implements Generat
type: getTextOfTsNode(this.noOptionalProperties ? type.typeNode : type.typeNodeWithoutUndefined),
hasQuestionToken: !this.noOptionalProperties && type.isOptional
};
})
}),
isExported: true
};
}

Expand Down Expand Up @@ -428,7 +430,8 @@ export class GeneratedUnionImpl<Context extends ModelContext> implements Generat
name: singleUnionType.getVisitorKey(),
type: getTextOfTsNode(singleUnionType.getVisitMethodSignature(context, this))
})
)
),
isExported: true
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ export abstract class AbstractRawSingleUnionType<Context> implements RawSingleUn
type: `"${this.discriminantValue}"`
},
...this.getNonDiscriminantPropertiesForInterface(context)
]
],
isExported: true
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ export class GeneratedUnionSchema<Context extends ModelContext> extends Abstract
)
)
)
)
),
isExported: true
});

for (const interfaceStructure of interfaces) {
Expand All @@ -85,7 +86,8 @@ export class GeneratedUnionSchema<Context extends ModelContext> extends Abstract
type: getTextOfTsNode(type.typeNodeWithoutUndefined),
hasQuestionToken: type.isOptional
};
})
}),
isExported: true
});
}
}
Expand Down
6 changes: 6 additions & 0 deletions generators/typescript/sdk/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.45.1] - 2024-12-27

- Fix: Export everything inside of TypeScript namespaces that used to be ambient.

For the `enableInlineTypes` feature, some namespaces were no longer declared (ambient), and types and interfaces inside the namespace would no longer be automatically exported without the `export` keyword. This fix exports everything that's inside these namespaces and also declared namespaces for good measure (in case they are not declared in the future).

## [0.45.0] - 2024-12-26

- Feat: Update dependencies of the generated TS SDK and Express generator. TypeScript has been updated to 5.7.2 which is a major version upgrade from 4.6.4.
Expand Down
2 changes: 1 addition & 1 deletion generators/typescript/sdk/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.45.0
0.45.1
Original file line number Diff line number Diff line change
Expand Up @@ -997,7 +997,8 @@ export class GeneratedSdkClientClassImpl implements GeneratedSdkClientClass {
hasQuestionToken: true,
docs: ["Additional headers to include in the request."]
}
]
],
isExported: true
};

const generatedVersion = context.versionContext.getGeneratedVersion();
Expand Down Expand Up @@ -1033,7 +1034,8 @@ export class GeneratedSdkClientClassImpl implements GeneratedSdkClientClass {
kind: StructureKind.Interface,
name: GeneratedSdkClientClassImpl.IDEMPOTENT_REQUEST_OPTIONS_INTERFACE_NAME,
extends: [GeneratedSdkClientClassImpl.REQUEST_OPTIONS_INTERFACE_NAME],
properties
properties,
isExported: true
};
}

Expand Down Expand Up @@ -1336,7 +1338,8 @@ export class GeneratedSdkClientClassImpl implements GeneratedSdkClientClass {
return {
kind: StructureKind.Interface,
name: GeneratedSdkClientClassImpl.OPTIONS_INTERFACE_NAME,
properties
properties,
isExported: true
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ export class GeneratedEndpointTypeSchemaImpl extends AbstractGeneratedEndpointTy
protected generateRawTypeDeclaration(context: SdkContext, module: ModuleDeclaration): void {
module.addTypeAlias({
name: AbstractGeneratedSchema.RAW_TYPE_NAME,
type: getTextOfTsNode(context.typeSchema.getReferenceToRawType(this.type).typeNode)
type: getTextOfTsNode(context.typeSchema.getReferenceToRawType(this.type).typeNode),
isExported: true
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ export class GeneratedSdkErrorSchemaImpl
protected generateRawTypeDeclaration(context: SdkContext, module: ModuleDeclaration): void {
module.addTypeAlias({
name: AbstractGeneratedSchema.RAW_TYPE_NAME,
type: getTextOfTsNode(context.typeSchema.getReferenceToRawType(this.type).typeNode)
type: getTextOfTsNode(context.typeSchema.getReferenceToRawType(this.type).typeNode),
isExported: true
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ export class GeneratedSdkInlinedRequestBodySchemaImpl
}),
extends: this.inlinedRequestBody.extends.map((extension) =>
getTextOfTsNode(context.typeSchema.getReferenceToRawNamedType(extension).getTypeNode())
)
),
isExported: true
});
}

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion seed/ts-express/alias-extends/serialization/types/Child.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion seed/ts-express/alias/serialization/types/Object_.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion seed/ts-express/alias/serialization/types/Type.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion seed/ts-express/alias/serialization/types/TypeId.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit b679c79

Please sign in to comment.