Skip to content

Commit

Permalink
🔧 fix: macro
Browse files Browse the repository at this point in the history
  • Loading branch information
SaltyAom committed Dec 17, 2023
1 parent 0390d52 commit 53cabf8
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 9 deletions.
27 changes: 20 additions & 7 deletions example/a.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,24 @@
import { Elysia, t } from '../src'
import { req } from '../test/utils'

const plugin = new Elysia()
const app = new Elysia()
.macro(({ onBeforeHandle }) => {
return {
hi(a: boolean) {
onBeforeHandle(() => {
console.log('A')
})
}
}
})
.get(
'/',
() => {
return 'b'
},
{
hi: true
}
)

const app = new Elysia().use(plugin).get('/', ({ store }) => store)

// const res = await app.handle(req('/')).then((r) => r.json())
// expect(res).toEqual({
// name: 'Ina'
// })
const res = await app.handle(req('/')).then((r) => r.text())
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "elysia",
"description": "Ergonomic Framework for Human",
"version": "0.8.0-rc.5",
"version": "0.8.0-rc.4",
"author": {
"name": "saltyAom",
"url": "https://github.com/SaltyAom",
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ export default class Elysia<
if (macro.$elysiaChecksum.includes(hash)) continue

// @ts-ignore
extension.$elysiaChecksum.push(
macro.$elysiaChecksum.push(
checksum(JSON.stringify(customHookValues))
)

Expand Down
1 change: 1 addition & 0 deletions src/ws/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export class ElysiaWS<
request: {}
store: {}
derive: {}
resolve: {}
}
> {
id: number
Expand Down
1 change: 1 addition & 0 deletions src/ws/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export namespace WS {
request: {}
store: {}
derive: {}
resolve: {}
},
Errors extends Record<string, Error> = {},
Path extends string = '',
Expand Down
File renamed without changes.

0 comments on commit 53cabf8

Please sign in to comment.