You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 27, 2024. It is now read-only.
Right now, using SapiModelMixin requires quite a bit of typing tapdancing:
import {
Db,
IDbGetParams,
IFromDbOptions,
Json,
Model,
SakuraApi,
SapiModelMixin
} from '@sakuraapi/api';
import {
Collection,
CollectionInsertOneOptions,
CollectionOptions,
Cursor,
Db as MongoDb,
DeleteWriteOpResultObject,
InsertOneWriteOpResult,
ObjectID,
ReplaceOneOptions,
UpdateWriteOpResult
} from 'mongodb';
import {dbs} from '../config/db';
export {
Collection,
CollectionInsertOneOptions,
CollectionOptions,
Cursor,
MongoDb,
DeleteWriteOpResultObject,
InsertOneWriteOpResult,
ObjectID,
ReplaceOneOptions,
UpdateWriteOpResult,
IDbGetParams,
IFromDbOptions,
SakuraApi
};
@Model({
dbConfig: dbs.user
})
export class User extends SapiModelMixin() {
}
See here to get a better understanding as to why all these exports are currently necessary.
The same applies to SapiInjectableMixin and SapiRoutableMixin, but to a lesser extent.
This translates to a fairly unideal developer experience (DX). To mitigate that for the moment, sapicli will implement (generators)[https://github.com/sakuraapi/cli/issues/10] for @Model, @Routable and @Injectable to get automate inclusion of the necessary exports. Check back in with: microsoft/TypeScript#9944 when TypeScript 2.8 is released to see if there's a less tedious way to handle this in the future.
Also, see if the TypeScript community suddenly decided to allow static members for interfaces, because that would be a better alternative seeing as these mixins don't actually do anything other than define types that are injected by various decorators (@Model, @Routable, @Injectable).
The text was updated successfully, but these errors were encountered:
Right now, using
SapiModelMixin
requires quite a bit of typing tapdancing:See here to get a better understanding as to why all these exports are currently necessary.
The same applies to
SapiInjectableMixin
andSapiRoutableMixin
, but to a lesser extent.This translates to a fairly unideal developer experience (DX). To mitigate that for the moment,
sapi
cli will implement (generators)[https://github.com/sakuraapi/cli/issues/10] for@Model
,@Routable
and@Injectable
to get automate inclusion of the necessary exports. Check back in with: microsoft/TypeScript#9944 when TypeScript 2.8 is released to see if there's a less tedious way to handle this in the future.Also, see if the TypeScript community suddenly decided to allow static members for interfaces, because that would be a better alternative seeing as these mixins don't actually do anything other than define types that are injected by various decorators (
@Model
,@Routable
,@Injectable
).The text was updated successfully, but these errors were encountered: