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

Remove generic parameter from Model #36

Merged
merged 1 commit into from
Sep 7, 2017
Merged

Conversation

andrenarchy
Copy link
Member

@andrenarchy andrenarchy commented Sep 7, 2017

By using the this type we can get rid of the generic Model parameter, possibly also allowing nice mixins (see #34). Defining models is now as elegant as it can be. 😛

Caveat

We lose the type safety on the data parameter in model constructors if the derived class does not implement a constructor à la

class Person extends Model {
  constructor(data?: Partial<Person>) {
    super(data);
  }
}

Issue #37 keeps track of this.

@codecov
Copy link

codecov bot commented Sep 7, 2017

Codecov Report

Merging #36 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master    #36   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          19     19           
  Lines         472    472           
  Branches      129    129           
=====================================
  Hits          472    472
Impacted Files Coverage Δ
packages/octonom/lib/collection.ts 100% <100%> (ø) ⬆️
packages/octonom/lib/validate.ts 100% <100%> (ø) ⬆️
.../octonom/test/data/models/group-with-references.ts 100% <100%> (ø) ⬆️
packages/octonom/test/data/models/person.ts 100% <100%> (ø) ⬆️
...ackages/octonom/test/data/models/person-account.ts 100% <100%> (ø) ⬆️
packages/octonom/test/data/models/cat.ts 100% <100%> (ø) ⬆️
packages/octonom/lib/model-array.ts 100% <100%> (ø) ⬆️
packages/octonom/lib/model.ts 100% <100%> (ø) ⬆️
packages/octonom/lib/errors.ts 100% <100%> (ø) ⬆️
packages/octonom/test/data/models/discussion.ts 100% <100%> (ø) ⬆️
... and 3 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1e887fa...9523850. Read the comment docs.

@andrenarchy andrenarchy merged commit c661f4d into master Sep 7, 2017
@andrenarchy andrenarchy deleted the ungeneric-model branch September 7, 2017 19:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant