Skip to content

Commit 059dde3

Browse files
committed
Add type for allowed methods
1 parent e88543f commit 059dde3

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/auto-check-element.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ type State = {
1212
controller: Controller | null
1313
}
1414

15+
enum AllowedHttpMethods {
16+
GET = 'GET',
17+
POST = 'POST',
18+
}
19+
1520
const states = new WeakMap<AutoCheckElement, State>()
1621

1722
class AutoCheckEvent extends Event {
@@ -178,7 +183,7 @@ export class AutoCheckElement extends HTMLElement {
178183
}
179184

180185
get httpMethod(): string {
181-
return this.getAttribute('http-method') || 'POST'
186+
return AllowedHttpMethods[this.getAttribute('http-method') as keyof typeof AllowedHttpMethods] || 'POST'
182187
}
183188
}
184189

0 commit comments

Comments
 (0)