fix(native): strict types in the address screen, Prettier on the native-auth e2e suite, file-local exports

The address screen's element helper returns the plain element instead of Object.assign's intersection, which strict mode could not represent; the haptics test reads an optional argument as optional; three exports only their own file used are local now.
This commit is contained in:
Maurice
2026-10-25 17:26:03 +01:00
parent a3b04887a1
commit 99c1a2d6c7
5 changed files with 14 additions and 12 deletions
+9 -2
View File
@@ -41,8 +41,15 @@ function failureMessage(reason: ProbeFailure): string {
}
}
function el<K extends keyof HTMLElementTagNameMap>(tag: K, props: Partial<HTMLElementTagNameMap[K]> = {}, ...children: (Node | string)[]) {
const node = Object.assign(document.createElement(tag), props)
function el<K extends keyof HTMLElementTagNameMap>(
tag: K,
props: Partial<HTMLElementTagNameMap[K]> = {},
...children: (Node | string)[]
): HTMLElementTagNameMap[K] {
// Typed as the plain element, not as Object.assign's intersection with the
// props, which strict mode cannot represent for an <input>.
const node: HTMLElementTagNameMap[K] = document.createElement(tag)
Object.assign(node, props)
node.append(...children)
return node
}
+1 -1
View File
@@ -19,7 +19,7 @@ describe('toastHaptic', () => {
toastHaptic('success')
toastHaptic('warning')
toastHaptic('error')
expect(vi.mocked(Haptics.notification).mock.calls.map(([o]) => o.type)).toEqual([
expect(vi.mocked(Haptics.notification).mock.calls.map(([o]) => o?.type)).toEqual([
NotificationType.Success, NotificationType.Warning, NotificationType.Error,
])
})
+2 -2
View File
@@ -16,10 +16,10 @@ import { isNativeIos } from './platform'
* the app.
*/
export const OFFLINE_SCHEME = 'trek-offline'
const OFFLINE_SCHEME = 'trek-offline'
const PREFIX = `${OFFLINE_SCHEME}://`
export function offlineTilesActive(): boolean {
function offlineTilesActive(): boolean {
return isNativeIos() && typeof caches !== 'undefined'
}
+1 -1
View File
@@ -4,7 +4,7 @@
*/
export type ProbeFailure = 'invalid' | 'unreachable' | 'notTrek' | 'tooOld'
export type ProbeResult =
type ProbeResult =
| { ok: true; url: string; reason?: undefined }
| { ok: false; reason: ProbeFailure; url?: undefined }
+1 -6
View File
@@ -45,12 +45,7 @@ let userId: number;
async function build() {
const moduleRef = await Test.createTestingModule({
imports: [
await TestUnitOfWorkModule.forRoot(db),
await createTestMikroOrmModule(db),
AuthModule,
NativeAuthModule,
],
imports: [await TestUnitOfWorkModule.forRoot(db), await createTestMikroOrmModule(db), AuthModule, NativeAuthModule],
})
.overrideProvider(MailerService)
.useValue({ sendPasswordResetEmail: vi.fn() })