-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #865 from And012/master
Types for ember-cookies
- Loading branch information
Showing
3 changed files
with
231 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
type Options = { | ||
maxAge?: number | string; | ||
domain?: string; | ||
expires?: Date; | ||
secure?: boolean; | ||
httpOnly?: boolean; | ||
path?: string; | ||
sameSite?: string; | ||
} | ||
|
||
declare module 'ember-cookies/test-support' { | ||
export default function clearAllCookies(param?: Options): void | ||
} | ||
|
||
declare module "ember-cookies/services/cookies" { | ||
import Service from "@ember/service"; | ||
|
||
type ReadOptions = { | ||
raw?: boolean; | ||
domain?: never; | ||
expires?: never; | ||
maxAge?: never; | ||
path?: never; | ||
}; | ||
|
||
type WriteOptions = { | ||
domain?: string; | ||
path?: string; | ||
secure?: boolean; | ||
raw?: boolean; | ||
sameSite?: "Strict" | "Lax" | "None"; | ||
signed?: never; | ||
} & ( | ||
| { expires?: Date; maxAge?: never } | ||
| { maxAge?: number; expires?: never } | ||
); | ||
|
||
type ClearOptions = { | ||
domain?: string; | ||
path?: string; | ||
secure?: boolean; | ||
|
||
expires?: never; | ||
maxAge?: never; | ||
raw?: never; | ||
}; | ||
|
||
export default class CookiesService extends Service { | ||
public read(name: string, options?: ReadOptions): string; | ||
public write(name: string, value: unknown, options?: WriteOptions): void; | ||
public clear(name: string, options?: ClearOptions): void; | ||
public exists(name: string): boolean; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.