Skip to content

Commit

Permalink
chore: remove typings.d.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
orzyyyy committed Sep 10, 2019
1 parent 459d310 commit 046aaf6
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 5 deletions.
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.

0 comments on commit 046aaf6

Please sign in to comment.