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

chore: remove typings.d.ts #208

Merged
merged 1 commit into from
Sep 10, 2019
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 server/service/DocumentService.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import fs from 'fs-extra';
import omit from 'omit.js';
import { omit } from '../utils/omit';
import prettier from 'prettier';
import { MappingProps } from '../controller/DocumentController';
import { getWriteMappingPaths } from '../utils/document';
Expand Down
16 changes: 16 additions & 0 deletions server/utils/__tests__/omit.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Forks from https://github.com/benjycui/omit.js
import { omit } from '../omit';

describe('omit', () => {
it('should create a shallow copy', () => {
const benjy = { name: 'Benjy' };
const copy = omit(benjy, []);
expect(copy).toEqual(benjy);
});

it('should drop fields which are passed in', () => {
const benjy = { name: 'Benjy', age: 18 };
expect(omit(benjy, ['age'])).toEqual({ name: 'Benjy' });
expect(omit(benjy, ['name', 'age'])).toEqual({});
});
});
14 changes: 14 additions & 0 deletions server/utils/omit.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Forks from https://github.com/benjycui/omit.js
export function omit<T, K extends keyof T>(
obj: T,
fields: Array<K>,
): Pick<T, Exclude<keyof T, K>> {
const shallowCopy = {
...obj,
};
for (let i = 0; i < fields.length; i++) {
const key = fields[i];
delete shallowCopy[key];
}
return shallowCopy;
}
3 changes: 1 addition & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,5 @@
"allowSyntheticDefaultImports": true,
"module": "esnext",
"outDir": "dist"
},
"typings": "./typings.d.ts"
}
}
2 changes: 0 additions & 2 deletions typings.d.ts

This file was deleted.