mirror of
https://github.com/bitwarden/browser
synced 2026-03-02 11:31:44 +00:00
[PM-25688] Remove ts-strict-ignore from FolderWithIdRequest and update importer service to use FolderRequest instead
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
import { CipherRequest } from "../../vault/models/request/cipher.request";
|
||||
import { FolderWithIdRequest } from "../../vault/models/request/folder-with-id.request";
|
||||
import { FolderRequest } from "../../vault/models/request/folder.request";
|
||||
|
||||
import { KvpRequest } from "./kvp.request";
|
||||
|
||||
export class ImportCiphersRequest {
|
||||
ciphers: CipherRequest[] = [];
|
||||
folders: FolderWithIdRequest[] = [];
|
||||
folders: FolderRequest[] = [];
|
||||
folderRelationships: KvpRequest<number, number>[] = [];
|
||||
}
|
||||
|
||||
@@ -1,25 +1,12 @@
|
||||
// FIXME: Update this file to be type safe and remove this and next line
|
||||
// @ts-strict-ignore
|
||||
import { Folder } from "../domain/folder";
|
||||
|
||||
import { FolderRequest } from "./folder.request";
|
||||
|
||||
export class FolderWithIdRequest extends FolderRequest {
|
||||
/**
|
||||
* Declared as `string` (not `string | null`) to satisfy the
|
||||
* {@link UserKeyRotationDataProvider}`<TRequest extends { id: string } | { organizationId: string }>`
|
||||
* constraint on `FolderService`.
|
||||
*
|
||||
* At runtime this is `null` for new import folders. PR #17077 enforced strict type-checking on
|
||||
* folder models, changing this assignment to `folder.id ?? ""` — causing the importer to send
|
||||
* `{"id":""}` instead of `{"id":null}`, which the server rejected.
|
||||
* The `|| null` below restores the pre-migration behavior while `@ts-strict-ignore` above
|
||||
* allows the `null` assignment against the `string` declaration.
|
||||
*/
|
||||
id: string;
|
||||
|
||||
constructor(folder: Folder) {
|
||||
super(folder);
|
||||
this.id = folder.id || null;
|
||||
this.id = folder.id;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user