Skip to content

Commit aa53a80

Browse files
committed
refactor: fix types
1 parent 1a089e1 commit aa53a80

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export default function ({ debug = false } = {}) {
1515
name: 'adapter-azure-swa',
1616

1717
async adapt(builder) {
18+
/** @type {import('./types/swa').StaticWebAppConfig} */
1819
const swaConfig = {
1920
routes: [
2021
{

types/swa.d.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// types adapted from https://docs.microsoft.com/en-us/azure/static-web-apps/configuration
2+
export interface StaticWebAppConfig {
3+
routes?: Route[];
4+
navigationFallback?: NavigationFallback;
5+
}
6+
7+
export interface Route {
8+
route: string;
9+
methods?: HttpMethod[];
10+
rewrite?: string;
11+
redirect?: string;
12+
statusCode?: number;
13+
headers?: Record<string, string>;
14+
allowedRoles?: string[];
15+
}
16+
17+
export interface NavigationFallback {
18+
rewrite: string;
19+
exclude?: string[];
20+
}
21+
22+
export type HttpMethod =
23+
| 'GET'
24+
| 'HEAD'
25+
| 'POST'
26+
| 'PUT'
27+
| 'DELETE'
28+
| 'CONNECT'
29+
| 'OPTIONS'
30+
| 'TRACE'
31+
| 'PATCH';

0 commit comments

Comments
 (0)