Skip to content

Commit c94f62b

Browse files
authored
Merge pull request #37 from lukas-reineke/T-245-bind-this
T-245 bind this
2 parents 868ebd4 + 9fd3167 commit c94f62b

9 files changed

+1966
-1313
lines changed

index.node.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.web.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 1096 additions & 662 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,26 +28,26 @@
2828
"lodash.get": "4.4.2"
2929
},
3030
"devDependencies": {
31-
"@adgorithmics/eslint-config-base": "1.3.0",
32-
"@graphql-codegen/cli": "1.8.1",
33-
"@graphql-codegen/introspection": "1.8.1",
34-
"@graphql-codegen/typescript": "1.8.1",
35-
"@graphql-codegen/typescript-resolvers": "1.8.1",
31+
"@adgorithmics/eslint-config-base": "1.4.2",
32+
"@graphql-codegen/cli": "1.8.3",
33+
"@graphql-codegen/introspection": "1.8.3",
34+
"@graphql-codegen/typescript": "1.8.3",
35+
"@graphql-codegen/typescript-resolvers": "1.8.3",
3636
"@types/graphql": "14.5.0",
3737
"@types/lodash.get": "4.4.6",
38-
"@typescript-eslint/eslint-plugin": "2.3.3",
39-
"@typescript-eslint/parser": "2.3.3",
38+
"@typescript-eslint/eslint-plugin": "2.9.0",
39+
"@typescript-eslint/parser": "2.9.0",
4040
"acorn": "^7.1.0",
4141
"concurrently": "5.0.0",
42-
"eslint": "6.5.1",
43-
"eslint-config-prettier": "6.4.0",
42+
"eslint": "6.7.1",
43+
"eslint-config-prettier": "6.7.0",
4444
"graphql": "14.5.8",
45-
"prettier": "1.18.2",
46-
"ts-loader": "6.2.0",
47-
"ts-transformer-keys": "0.3.5",
48-
"typescript": "3.6.3",
49-
"webpack": "4.41.0",
50-
"webpack-cli": "3.3.9"
45+
"prettier": "1.19.1",
46+
"ts-loader": "6.2.1",
47+
"ts-transformer-keys": "0.4.1",
48+
"typescript": "3.7.2",
49+
"webpack": "4.41.2",
50+
"webpack-cli": "3.3.10"
5151
},
5252
"prettier": {
5353
"trailingComma": "all",

src/helpers.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export declare function bind<T extends Function>(_target: object, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T> | void;

src/helpers.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// stripped down version of https://github.com/NoHomey/bind-decorator
2+
export function bind<T extends Function>(
3+
_target: object,
4+
propertyKey: string,
5+
descriptor: TypedPropertyDescriptor<T>,
6+
): TypedPropertyDescriptor<T> | void {
7+
return {
8+
configurable: true,
9+
get(this: T): T {
10+
const bound: T = descriptor.value?.bind(this);
11+
Object.defineProperty(this, propertyKey, {
12+
value: bound,
13+
configurable: true,
14+
writable: true,
15+
});
16+
return bound;
17+
},
18+
};
19+
}

src/index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -569,3 +569,4 @@ export declare class Cinnamon {
569569
}
570570
export * from './generated/graphql';
571571
export * from './inputFields';
572+
export * from './helpers';

0 commit comments

Comments
 (0)