Skip to content

Commit

Permalink
fix: don't set template Context on BaseContextClass (#284)
Browse files Browse the repository at this point in the history
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Refactor**
	- Simplified `BaseContextClass` by removing generic type parameters
	- Standardized context type handling within the class
- Updated class, property, and constructor type definitions to use a
consistent `Context` type

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
  • Loading branch information
fengmk2 authored Jan 2, 2025
1 parent 8a61a50 commit 45b0504
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/base_context_class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ import type { EggCore, Context } from './egg.js';
* it's instantiated in context level,
* {@link Helper}, {@link Service} is extending it.
*/
export class BaseContextClass<T extends Context = Context> {
ctx: T;
export class BaseContextClass {
ctx: Context;
app: EggCore;
config: Record<string, any>;
service: BaseContextClass<T>;
service: BaseContextClass;

/**
* @since 1.0.0
*/
constructor(ctx: T) {
constructor(ctx: Context) {
/**
* @member {Context} BaseContextClass#ctx
* @since 1.0.0
Expand All @@ -34,6 +34,6 @@ export class BaseContextClass<T extends Context = Context> {
* @member {Service} BaseContextClass#service
* @since 1.0.0
*/
this.service = ctx.service as BaseContextClass<T>;
this.service = ctx.service;
}
}

0 comments on commit 45b0504

Please sign in to comment.