Skip to content

Commit

Permalink
fix: correct redirect conditions type (#3908)
Browse files Browse the repository at this point in the history
  • Loading branch information
ascorbic authored Dec 1, 2021
1 parent 419afda commit 0bdb973
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions packages/build/test-d/config/netlify_config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ const testNetlifyConfigRedirects: OnPreBuild = function ({
expectType<string | undefined>(redirect.signed)
expectType<string | undefined>(redirect.query && redirect.query.testVar)
expectType<string | undefined>(redirect.headers && redirect.headers.testVar)
expectType<readonly string[] | undefined>(
redirect.conditions && redirect.conditions.language && redirect.conditions.language,
)
if (redirect.conditions !== undefined) {
expectType<readonly string[] | undefined>(redirect.conditions.Language)
expectType<readonly string[] | undefined>(redirect.conditions.Cookie)
expectType<readonly string[] | undefined>(redirect.conditions.Country)
expectType<readonly string[] | undefined>(redirect.conditions.Role)
}
}
2 changes: 1 addition & 1 deletion packages/build/types/config/netlify_config.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ interface Redirect {
signed?: string
query?: Partial<Record<string, string>>
headers?: Partial<Record<string, string>>
conditions?: Record<'language' | 'role' | 'country', readonly string[]>
conditions?: Partial<Record<'Language' | 'Role' | 'Country' | 'Cookie', readonly string[]>>
}

interface Header {
Expand Down

0 comments on commit 0bdb973

Please sign in to comment.