Skip to content
This repository has been archived by the owner on Oct 14, 2020. It is now read-only.

bugfix: Including default "finally" hook. The fixe includes the property required by type HooksObject. #271

Closed
wants to merge 1 commit into from

Conversation

neutron37
Copy link

@neutron37 neutron37 commented May 7, 2019

Summary

  • Tested on CLI Plus Version: 0.8.10
  • The error occurs in a new project when running yarn start for the first time after feathers-plus generate app. (See my feathers-gen-specs.json below if needed.)

Details of Error Message

yarn run v1.13.0
$ ts-node --files src/

/Volumes/dev/camera-challenge-fjs/node_modules/ts-node/src/index.ts:261
    return new TSError(diagnosticText, diagnosticCodes)
           ^
TSError: ⨯ Unable to compile TypeScript:
src/app.hooks.ts(15,5): error TS2741: Property 'finally' is missing in type '{ before: { all: Hook[]; find: never[]; get: never[]; create: never[]; update: never[]; patch: never[]; remove: never[]; }; after: { all: Hook[]; find: never[]; get: never[]; create: never[]; update: never[]; patch: never[]; remove: never[]; }; error: { ...; }; }' but required in type 'HooksObject'.

The feathers-gen-specs.json if needed to reproduce error

{
  "options": {
    "ver": "1.0.0",
    "inspectConflicts": false,
    "semicolons": true,
    "freeze": [],
    "ts": true
  },
  "app": {
    "environmentsAllowingSeedData": "",
    "seedData": false,
    "name": "camera-challenge-fjs",
    "description": "Project camera-challenge-fjs",
    "src": "src",
    "packager": "yarn@>= 0.18.0",
    "providers": [
      "rest",
      "socketio"
    ]
  },
  "services": {},
  "hooks": {}
}

…erty in type HooksObject.

* Tested on CLI Plus Version: 0.8.10
* See my feathers-gen-specs.json below if needed.
* The error occurs when running `yarn start` immediately after `feathers-plus generate app`.

**Excerpt of error message:**

```
yarn run v1.13.0
$ ts-node --files src/

/Volumes/dev/camera-challenge-fjs/node_modules/ts-node/src/index.ts:261
    return new TSError(diagnosticText, diagnosticCodes)
           ^
TSError: ⨯ Unable to compile TypeScript:
src/app.hooks.ts(15,5): error TS2741: Property 'finally' is missing in type '{ before: { all: Hook[]; find: never[]; get: never[]; create: never[]; update: never[]; patch: never[]; remove: never[]; }; after: { all: Hook[]; find: never[]; get: never[]; create: never[]; update: never[]; patch: never[]; remove: never[]; }; error: { ...; }; }' but required in type 'HooksObject'.
```

**My feathers-gen-specs.json**

```
{
  "options": {
    "ver": "1.0.0",
    "inspectConflicts": false,
    "semicolons": true,
    "freeze": [],
    "ts": true
  },
  "app": {
    "environmentsAllowingSeedData": "",
    "seedData": false,
    "name": "camera-challenge-fjs",
    "description": "Project camera-challenge-fjs",
    "src": "src",
    "packager": "yarn@>= 0.18.0",
    "providers": [
      "rest",
      "socketio"
    ]
  },
  "services": {},
  "hooks": {}
}
```
@neutron37
Copy link
Author

Actually, this PR only patches just one of many files which may need changes.

Grep tells me the following 153 files look similarly ... Do they all need a "finally" property added?

test-expands/cumulative-2-sequelize-services.test-expected/src1/app.hooks.js
test-expands/cumulative-2-nedb-batchloaders.test-expected/src1/app.hooks.js
test-expands/authentication-3.test-expected/src1/app.hooks.js
test-expands/graphql-auth.test-expected/src1/app.hooks.js
test-expands/cumulative-1-mongoose.test-expected/src1/app.hooks.js
test-expands/graphql.test-expected/src1/app.hooks.js
test-expands/cumulative-1-nedb.test-expected/src1/app.hooks.js
test-expands/cumulative-1-no-semicolons.test-expected/src1/app.hooks.js
test-expands/app-code-blocks.test-expected/src1/app.hooks.js
test-expands/app.test-expected/src1/app.hooks.js
test-expands/cumulative-1-generic.test-expected/src1/app.hooks.js
test-expands/cumulative-1-memory.test-expected/src1/app.hooks.js
test-expands/service-naming.test-expected/src1/app.hooks.js
test-expands/middleware.test-expected/src1/app.hooks.js
test-expands/cumulative-1-mongo.test-expected/src1/app.hooks.js
test-expands/regen-adapters-1.test-expected/src1/app.hooks.js
test-expands/service.test-expected/src1/app.hooks.js
test-expands/app-eslintrc.test-expected/src1/app.hooks.js
test-expands/scaffolding.test-expected/src1/app.hooks.js
test-expands/authentication-1.test-expected/src1/app.hooks.js
test-expands/authentication-2.test-expected/src1/app.hooks.js
test-expands/name-space.test-expected/src1/app.hooks.js
test-expands/regen-user-entity.test-expected/src1/app.hooks.js
test-expands/cumulative-2-hooks.test-expected/src1/app.hooks.js
test-expands/app-freeze.test-expected/src1/app.hooks.js
test-expands/a-specs/service-sequelize-mssql.test-expected/src1/app.hooks.js
examples/js/07-fakes/feathers-app/src/app.hooks.js
examples/js/03-authentication/feathers-app/src/app.hooks.js
examples/js/06-service/feathers-app/src/app.hooks.js
examples/js/10-hook/feathers-app/src/app.hooks.js
examples/js/04-model/feathers-app/src/app.hooks.js
examples/js/09-graphql/feathers-app/src/app.hooks.js
examples/js/02-app/feathers-app/src/app.hooks.js
examples/js/05-secret/feathers-app/src/app.hooks.js
examples/js/12-test-examples/feathers-app/src/app.hooks.js
test-expands/cumulative-2-sequelize-services.test-expected/src1/services/users-1/users-1.hooks.js
test-expands/cumulative-2-sequelize-services.test-expected/src1/services/nedb-2/nedb-2.hooks.js
test-expands/cumulative-2-sequelize-services.test-expected/src1/services/graphql/graphql.hooks.js
test-expands/cumulative-2-sequelize-services.test-expected/src1/services/nedb-1/nedb-1.hooks.js
examples/js/11-test/feathers-app/src/app.hooks.js
test-expands/cumulative-2-nedb-batchloaders.test-expected/src1/services/nedb-2/nedb-2.hooks.js
test-expands/cumulative-2-nedb-batchloaders.test-expected/src1/services/graphql/graphql.hooks.js
test-expands/cumulative-2-nedb-batchloaders.test-expected/src1/services/users-1/users-1.hooks.js
test-expands/cumulative-2-nedb-batchloaders.test-expected/src1/services/nedb-1/nedb-1.hooks.js
test-expands/authentication-3.test-expected/src1/services/users-1/users-1.hooks.js
test-expands/authentication-3.test-expected/src1/services/nedb-2/nedb-2.hooks.js
test-expands/authentication-3.test-expected/src1/services/nedb-1/nedb-1.hooks.js
test-expands/graphql-auth.test-expected/src1/services/nedb-2/nedb-2.hooks.js
test-expands/graphql-auth.test-expected/src1/services/graphql/graphql.hooks.js
test-expands/graphql-auth.test-expected/src1/services/nedb-1/nedb-1.hooks.js
test-expands/graphql-auth.test-expected/src1/services/users-1/users-1.hooks.js
test-expands/cumulative-1-mongoose.test-expected/src1/services/nedb-2/nedb-2.hooks.js
test-expands/cumulative-1-mongoose.test-expected/src1/services/users-1/users-1.hooks.js
test-expands/cumulative-1-mongoose.test-expected/src1/services/graphql/graphql.hooks.js
test-expands/cumulative-1-mongoose.test-expected/src1/services/nedb-1/nedb-1.hooks.js
test-expands/graphql.test-expected/src1/services/nedb-2/nedb-2.hooks.js
test-expands/cumulative-1-nedb.test-expected/src1/services/users-1/users-1.hooks.js
test-expands/graphql.test-expected/src1/services/graphql/graphql.hooks.js
test-expands/graphql.test-expected/src1/services/nedb-1/nedb-1.hooks.js
test-expands/cumulative-1-nedb.test-expected/src1/services/graphql/graphql.hooks.js
test-expands/cumulative-1-nedb.test-expected/src1/services/nedb-1/nedb-1.hooks.js
test-expands/cumulative-1-nedb.test-expected/src1/services/nedb-2/nedb-2.hooks.js
test-expands/a-gens/js/test-hook-integ.test-expected/src1/app.hooks.js
test-expands/a-gens/js/test-hook-unit.test-expected/src1/app.hooks.js
test-expands/cumulative-1-no-semicolons.test-expected/src1/services/nedb-2/nedb-2.hooks.js
test-expands/cumulative-1-no-semicolons.test-expected/src1/services/users-1/users-1.hooks.js
test-expands/cumulative-1-no-semicolons.test-expected/src1/services/nedb-1/nedb-1.hooks.js
test-expands/cumulative-1-no-semicolons.test-expected/src1/services/graphql/graphql.hooks.js
test-expands/a-gens/js/test-authentication.test-expected/src1/app.hooks.js
test-expands/a-gens/js/test-service.test-expected/src1/app.hooks.js
test-expands/a-gens/js/cumulative.test-expected/src1/app.hooks.js
test-expands/cumulative-1-generic.test-expected/src1/services/nedb-2/nedb-2.hooks.js
test-expands/cumulative-1-generic.test-expected/src1/services/graphql/graphql.hooks.js
test-expands/cumulative-1-generic.test-expected/src1/services/users-1/users-1.hooks.js
test-expands/cumulative-1-generic.test-expected/src1/services/nedb-1/nedb-1.hooks.js
test-expands/cumulative-1-memory.test-expected/src1/services/nedb-2/nedb-2.hooks.js
test-expands/cumulative-1-memory.test-expected/src1/services/users-1/users-1.hooks.js
test-expands/cumulative-1-memory.test-expected/src1/services/graphql/graphql.hooks.js
test-expands/cumulative-1-memory.test-expected/src1/services/nedb-1/nedb-1.hooks.js
test-expands/service-naming.test-expected/src1/services/users1/users1.hooks.js
test-expands/service-naming.test-expected/src1/services/graphql/graphql.hooks.js
test-expands/service-naming.test-expected/src1/services/nedb-1/nedb-1.hooks.js
test-expands/middleware.test-expected/src1/services/nedb-1/nedb-1.hooks.js
test-expands/middleware.test-expected/src1/services/nedb-2/nedb-2.hooks.js
test-expands/cumulative-1-mongo.test-expected/src1/services/users-1/users-1.hooks.js
test-expands/service-naming.test-expected/src1/services/nedb-2/nedb-2.hooks.js
test-expands/cumulative-1-mongo.test-expected/src1/services/nedb-2/nedb-2.hooks.js
test-expands/cumulative-1-mongo.test-expected/src1/services/graphql/graphql.hooks.js
test-expands/cumulative-1-mongo.test-expected/src1/services/nedb-1/nedb-1.hooks.js
test-expands/regen-adapters-1.test-expected/src1/services/nedb-1/nedb-1.hooks.js
test-expands/service.test-expected/src1/services/nedb-1/nedb-1.hooks.js
test-expands/service.test-expected/src1/services/nedb-2/nedb-2.hooks.js
test-expands/authentication-1.test-expected/src1/services/users-1/users-1.hooks.js
test-expands/authentication-2.test-expected/src1/services/nedb-1/nedb-1.hooks.js
test-expands/authentication-2.test-expected/src1/services/users-1/users-1.hooks.js
test-expands/regen-user-entity.test-expected/src1/services/nedb-1/nedb-1.hooks.js
test-expands/name-space.test-expected/src1/services/nedb-1/nedb-1.hooks.js
test-expands/cumulative-2-hooks.test-expected/src1/services/nedb-2/nedb-2.hooks.js
test-expands/cumulative-2-hooks.test-expected/src1/services/users-1/users-1.hooks.js
test-expands/cumulative-2-hooks.test-expected/src1/services/nedb-1/nedb-1.hooks.js
test-expands/regen-user-entity.test-expected/src1/services/users-1/users-1.hooks.js
test-expands/cumulative-2-hooks.test-expected/src1/services/graphql/graphql.hooks.js
test-expands/a-specs/service-sequelize-mssql.test-expected/src1/services/users/users.hooks.js
test-expands/name-space.test-expected/src1/services/a-1/nedb-3/nedb-3.hooks.js
test-expands/name-space.test-expected/src1/services/a-1/nedb-2/nedb-2.hooks.js
test-expands/name-space.test-expected/src1/services/c-1/nedb-6/nedb-6.hooks.js
examples/js/07-fakes/feathers-app/src/services/roles/roles.hooks.js
examples/js/07-fakes/feathers-app/src/services/users/users.hooks.js
examples/js/03-authentication/feathers-app/src/services/users/users.hooks.js
examples/js/07-fakes/feathers-app/src/services/teams/teams.hooks.js
examples/js/06-service/feathers-app/src/services/roles/roles.hooks.js
examples/js/10-hook/feathers-app/src/services/graphql/graphql.hooks.js
examples/js/06-service/feathers-app/src/services/users/users.hooks.js
examples/js/10-hook/feathers-app/src/services/roles/roles.hooks.js
examples/js/10-hook/feathers-app/src/services/users/users.hooks.js
examples/js/06-service/feathers-app/src/services/teams/teams.hooks.js
examples/js/10-hook/feathers-app/src/services/teams/teams.hooks.js
examples/js/04-model/feathers-app/src/services/users/users.hooks.js
examples/js/09-graphql/feathers-app/src/services/roles/roles.hooks.js
examples/js/09-graphql/feathers-app/src/services/teams/teams.hooks.js
examples/js/09-graphql/feathers-app/src/services/users/users.hooks.js
examples/js/09-graphql/feathers-app/src/services/graphql/graphql.hooks.js
examples/js/05-secret/feathers-app/src/services/users/users.hooks.js
examples/js/12-test-examples/feathers-app/src/services/roles/roles.hooks.js
examples/js/12-test-examples/feathers-app/src/services/graphql/graphql.hooks.js
examples/js/12-test-examples/feathers-app/src/services/users/users.hooks.js
examples/js/12-test-examples/feathers-app/src/services/teams/teams.hooks.js
examples/js/11-test/feathers-app/src/services/roles/roles.hooks.js
examples/js/11-test/feathers-app/src/services/graphql/graphql.hooks.js
examples/js/11-test/feathers-app/src/services/teams/teams.hooks.js
examples/js/11-test/feathers-app/src/services/users/users.hooks.js
test-expands/a-gens/js/test-hook-integ.test-expected/src1/services/nedb-2/nedb-2.hooks.js
test-expands/a-gens/js/test-hook-integ.test-expected/src1/services/graphql/graphql.hooks.js
test-expands/a-gens/js/test-hook-integ.test-expected/src1/services/users-1/users-1.hooks.js
test-expands/a-gens/js/test-hook-integ.test-expected/src1/services/nedb-1/nedb-1.hooks.js
test-expands/a-gens/js/test-hook-unit.test-expected/src1/services/nedb-2/nedb-2.hooks.js
test-expands/a-gens/js/test-hook-unit.test-expected/src1/services/nedb-1/nedb-1.hooks.js
test-expands/a-gens/js/test-hook-unit.test-expected/src1/services/graphql/graphql.hooks.js
test-expands/a-gens/js/test-hook-unit.test-expected/src1/services/users-1/users-1.hooks.js
test-expands/a-gens/js/test-authentication.test-expected/src1/services/nedb-2/nedb-2.hooks.js
test-expands/a-gens/js/test-authentication.test-expected/src1/services/users-1/users-1.hooks.js
test-expands/a-gens/js/test-authentication.test-expected/src1/services/nedb-1/nedb-1.hooks.js
test-expands/a-gens/js/test-authentication.test-expected/src1/services/graphql/graphql.hooks.js
test-expands/a-gens/js/test-service.test-expected/src1/services/graphql/graphql.hooks.js
test-expands/a-gens/js/test-service.test-expected/src1/services/nedb-2/nedb-2.hooks.js
test-expands/a-gens/js/cumulative.test-expected/src1/services/users1/users1.hooks.js
test-expands/a-gens/js/test-service.test-expected/src1/services/nedb-1/nedb-1.hooks.js
test-expands/a-gens/js/cumulative.test-expected/src1/services/graphql/graphql.hooks.js
test-expands/a-gens/js/cumulative.test-expected/src1/services/nedb2/nedb2.hooks.js
test-expands/a-gens/js/test-service.test-expected/src1/services/users-1/users-1.hooks.js
test-expands/a-gens/js/cumulative.test-expected/src1/services/nedb1/nedb1.hooks.js
test-expands/name-space.test-expected/src1/services/a-1/b-1/nedb-4/nedb-4.hooks.js
test-expands/name-space.test-expected/src1/services/a-1/b-1/nedb-5/nedb-5.hooks.js

@bitflower
Copy link

This was fixed in the typings here:
feathersjs/feathers#1350

and here:
DefinitelyTyped/DefinitelyTyped#35524

@daffl daffl closed this Oct 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants