Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor(tests)/ban-types #1671

Merged
merged 2 commits into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/fixtures/testModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1203,7 +1203,7 @@ export class TestClassModel extends TestClassBaseModel {
}

type NonFunctionPropertyNames<T> = {
[K in keyof T]: T[K] extends Function ? never : K;
[K in keyof T]: T[K] extends CallableFunction ? never : K;
}[keyof T];
type NonFunctionProperties<T> = Pick<T, NonFunctionPropertyNames<T>>;
export class GetterClass {
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/swagger/definitionsGeneration/definitions.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ describe('Definition generation', () => {
const dynamicMetadata = new MetadataGenerator('./fixtures/controllers/getController.ts', undefined, undefined, ['./fixtures/controllers/getController.ts']).Generate();
const defaultConfig = getDefaultOptions();
const defaultOptions: ExtendedSpecConfig = { ...defaultConfig.spec, entryFile: defaultConfig.entryFile, noImplicitAdditionalProperties: 'ignore' };
const optionsWithNoAdditional = Object.assign<{}, ExtendedSpecConfig, Partial<ExtendedSpecConfig>>({}, defaultOptions, {
const optionsWithNoAdditional = Object.assign<object, ExtendedSpecConfig, Partial<ExtendedSpecConfig>>({}, defaultOptions, {
noImplicitAdditionalProperties: 'silently-remove-extras',
});
const optionsWithXEnumVarnames = Object.assign<{}, ExtendedSpecConfig, Partial<ExtendedSpecConfig>>({}, defaultOptions, {
const optionsWithXEnumVarnames = Object.assign<object, ExtendedSpecConfig, Partial<ExtendedSpecConfig>>({}, defaultOptions, {
xEnumVarnames: true,
});
interface SpecAndName {
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/swagger/parameterDetails3.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('Parameter generation for OpenAPI 3.0.0', () => {

const defaultConfig = getDefaultOptions();
const defaultOptions: ExtendedSpecConfig = { ...defaultConfig.spec, noImplicitAdditionalProperties: 'ignore', entryFile: defaultConfig.entryFile };
const optionsWithNoAdditional = Object.assign<{}, ExtendedSpecConfig, Partial<ExtendedSpecConfig>>({}, defaultOptions, {
const optionsWithNoAdditional = Object.assign<object, ExtendedSpecConfig, Partial<ExtendedSpecConfig>>({}, defaultOptions, {
noImplicitAdditionalProperties: 'silently-remove-extras',
});

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/swagger/schemaDetails.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ describe('Schema details generation', () => {

describe('methods', () => {
describe('operationId', () => {
const optionsWithOperationIdTemplate = Object.assign<{}, ExtendedSpecConfig, Partial<ExtendedSpecConfig>>({}, getDefaultExtendedOptions(), {
const optionsWithOperationIdTemplate = Object.assign<object, ExtendedSpecConfig, Partial<ExtendedSpecConfig>>({}, getDefaultExtendedOptions(), {
operationIdTemplate: "{{replace controllerName 'Controller' ''}}_{{titleCase method.name}}",
});

Expand Down
8 changes: 4 additions & 4 deletions tests/unit/swagger/schemaDetails3.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ describe('Definition generation for OpenAPI 3.0.0', () => {
const metadataPost = new MetadataGenerator('./fixtures/controllers/postController.ts').Generate();

const defaultOptions: ExtendedSpecConfig = getDefaultExtendedOptions();
const optionsWithNoAdditional = Object.assign<{}, ExtendedSpecConfig, Partial<ExtendedSpecConfig>>({}, defaultOptions, {
const optionsWithNoAdditional = Object.assign<object, ExtendedSpecConfig, Partial<ExtendedSpecConfig>>({}, defaultOptions, {
noImplicitAdditionalProperties: 'silently-remove-extras',
});
const optionsWithXEnumVarnames = Object.assign<{}, ExtendedSpecConfig, Partial<ExtendedSpecConfig>>({}, defaultOptions, {
const optionsWithXEnumVarnames = Object.assign<object, ExtendedSpecConfig, Partial<ExtendedSpecConfig>>({}, defaultOptions, {
xEnumVarnames: true,
});
const optionsWithOperationIdTemplate = Object.assign<{}, ExtendedSpecConfig, Partial<ExtendedSpecConfig>>({}, defaultOptions, {
const optionsWithOperationIdTemplate = Object.assign<object, ExtendedSpecConfig, Partial<ExtendedSpecConfig>>({}, defaultOptions, {
operationIdTemplate: "{{replace controllerName 'Controller' ''}}_{{titleCase method.name}}",
});

Expand Down Expand Up @@ -91,7 +91,7 @@ describe('Definition generation for OpenAPI 3.0.0', () => {
});

it('should have relative URL when no host is defined', () => {
const optionsWithNoHost = Object.assign<{}, ExtendedSpecConfig>({}, defaultOptions);
const optionsWithNoHost = Object.assign<object, ExtendedSpecConfig>({}, defaultOptions);
delete optionsWithNoHost.host;

const spec: Swagger.Spec3 = new SpecGenerator3(metadataGet, optionsWithNoHost).GetSpec();
Expand Down
Loading