httpx

Collection of libs: http exceptions, dsn-parser...

MIT License

Downloads
67.2K
Stars
16
Committers
5

Bot releases are hidden (Show)

httpx - [email protected]

Published by belgattitude 2 months ago

Patch Changes

httpx - @httpx/[email protected]

Published by belgattitude 3 months ago

Minor Changes

httpx - @httpx/[email protected]

Published by belgattitude 4 months ago

Patch Changes

httpx - @httpx/[email protected]

Published by belgattitude 4 months ago

Minor Changes

httpx - @httpx/[email protected]

Published by belgattitude 5 months ago

Major Changes

httpx - @httpx/[email protected]

Published by belgattitude 5 months ago

Minor Changes

httpx - @httpx/[email protected]

Published by belgattitude 5 months ago

Minor Changes

httpx - @httpx/[email protected]

Published by belgattitude 5 months ago

Patch Changes

httpx - @httpx/[email protected]

Published by belgattitude 5 months ago

Patch Changes

httpx - @httpx/[email protected]

Published by belgattitude 5 months ago

Patch Changes

httpx - @httpx/[email protected]

Published by belgattitude 5 months ago

Minor Changes

  • #1231 fd2ecd3 Thanks @belgattitude! - Improve PlainObject convenience typings when passing a generic.

    import { isPlainObject, assertPlainObject } from "@httpx/assert";
    
    type TValue = {
      key: string;
      deep: {
        connected: boolean;
      };
    };
    const value = {
      key: "hello",
      deep: {
        connected: true,
      },
    } as unknown;
    
    // Without generic
    
    assertPlainObject(value);
    // value is Record<string, unknown>
    // -> no typing
    
    value.key; // unknown, no runtime error
    value.anything; // unknown, no runtime error
    // value.deep.connected // not possible without explicit typing
    
    // With generic
    
    assertPlainObject<TValue>(value);
    
    value.key; // unknown, no runtime error
    value.anything; // unknown, no runtime error
    value.deep?.connected; // connected is 'unknown', typescript suggest the type
    
httpx - @httpx/[email protected]

Published by belgattitude 5 months ago

Minor Changes

httpx - @httpx/[email protected]

Published by belgattitude 5 months ago

Minor Changes

httpx - @httpx/[email protected]

Published by belgattitude 5 months ago

Patch Changes

  • #1214 226a4b1 Thanks @belgattitude! - isPlainObject allows Object.create(null) and disallow stringTagName and iterators symbols
httpx - @httpx/[email protected]

Published by belgattitude 6 months ago

Patch Changes

httpx - @httpx/[email protected]

Published by belgattitude 6 months ago

Patch Changes

httpx - @httpx/[email protected]

Published by belgattitude 6 months ago

Minor Changes

  • #1171 7fdbf08 Thanks @belgattitude! - Add generic convenience typing in isPlainObject

    You can now pass a generic type in isPlainObject and assertPlainObject.

    It allows to get typescript autocompletion after running isPlainObject(v).
    But notice all keys becomes optional and values are set to unknown in this case to reflect
    that no runtime check was done.

    isPlainObject

    Name Type Comment
    isPlainObject<T?> PlainObject<T extends Record<string, unknown> = Record<string, unknown>
    assertPlainObject<T?> PlainObject<T extends Record<string, unknown> = Record<string, unknown>
    import { isPlainObject, assertPlainObject } from "@httpx/assert";
    
    // Simple case: without generic value
    isPlainObject({ cwol: true }); // 👈 true
    isPlainObject(new Promise()); // 👈 false
    assertPlainObject({});
    
    // With generic value (unchecked at runtime!)
    type CustomType = {
      name: string;
      deep: {
        yes: boolean | null;
      };
    };
    const value = {
      name: "hello",
      deep: {
        yes: true,
      },
    } as unknown;
    
    if (isPlainObject<CustomType>(value)) {
      // Notice it's a deep partial to allow autocompletion
      const test = value?.deep?.yes; // 👈  yes will be unknown (no runtime check)
    }
    
httpx - @httpx/[email protected]

Published by belgattitude 6 months ago

Patch Changes

httpx - @httpx/[email protected]

Published by belgattitude 6 months ago

Minor Changes

Patch Changes

httpx - @httpx/[email protected]

Published by belgattitude 6 months ago

Patch Changes