Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

remix-typedjson

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

remix-typedjson - npm Package Compare versions

Comparing version 0.3.1 to 0.4.0

5

CHANGELOG.md
# CHANGELOG
## 🚀 v0.4.0
- ✨ Add support for `key` in `useTypedFetcher` [#35](https://github.com/kiliman/remix-typedjson/issues/35)
- 🔥 Deprecate `TypedMetaFunction` since it didn't work anyway
## 🚀 v0.3.1

@@ -4,0 +9,0 @@

10

dist/esm/remix.d.ts
/// <reference types="react" />
import { HtmlMetaDescriptor, Params, type FetcherWithComponents } from '@remix-run/react';
import { MetaDescriptor, Params, useFetcher, type FetcherWithComponents } from '@remix-run/react';
import type { MetaType } from './typedjson';

@@ -28,3 +28,3 @@ export type TypedJsonFunction = <Data extends unknown>(data: Data, init?: number | ResponseInit) => TypedJsonResponse<Data>;

};
export declare function TypedAwait<T>(props: TypedAwaitProps<T>): JSX.Element | null;
export declare function TypedAwait<T>(props: TypedAwaitProps<T>): import("react/jsx-runtime").JSX.Element | null;
export declare function useTypedLoaderData<T = AppData>(): UseDataFunctionReturn<T>;

@@ -35,3 +35,4 @@ export declare function useTypedActionData<T = AppData>(): UseDataFunctionReturn<T> | null;

};
export declare function useTypedFetcher<T>(): TypedFetcherWithComponents<T>;
type FetcherArgs = Parameters<typeof useFetcher>[0];
export declare function useTypedFetcher<T>(opts?: FetcherArgs): TypedFetcherWithComponents<T>;
export declare function useTypedRouteLoaderData<T = AppData>(id: string): UseDataFunctionReturn<T> | undefined;

@@ -60,2 +61,3 @@ export type RemixSerializedType<T> = {

}
/** @deprecated */
export interface TypedMetaFunction<Loader extends LoaderFunction | unknown = unknown, ParentsLoaders extends Record<string, LoaderFunction> = {}> {

@@ -69,4 +71,4 @@ (args: {

location: Location;
}): HtmlMetaDescriptor;
}): MetaDescriptor;
}
export {};

4

dist/esm/remix.js

@@ -60,4 +60,4 @@ import { jsx as _jsx } from "react/jsx-runtime";

}
export function useTypedFetcher() {
const fetcher = useFetcher();
export function useTypedFetcher(opts) {
const fetcher = useFetcher(opts);
if (fetcher.data) {

@@ -64,0 +64,0 @@ const newData = deserializeRemix(fetcher.data);

/// <reference types="react" />
import { HtmlMetaDescriptor, Params, type FetcherWithComponents } from '@remix-run/react';
import { MetaDescriptor, Params, useFetcher, type FetcherWithComponents } from '@remix-run/react';
import type { MetaType } from './typedjson';

@@ -28,3 +28,3 @@ export type TypedJsonFunction = <Data extends unknown>(data: Data, init?: number | ResponseInit) => TypedJsonResponse<Data>;

};
export declare function TypedAwait<T>(props: TypedAwaitProps<T>): JSX.Element | null;
export declare function TypedAwait<T>(props: TypedAwaitProps<T>): import("react/jsx-runtime").JSX.Element | null;
export declare function useTypedLoaderData<T = AppData>(): UseDataFunctionReturn<T>;

@@ -35,3 +35,4 @@ export declare function useTypedActionData<T = AppData>(): UseDataFunctionReturn<T> | null;

};
export declare function useTypedFetcher<T>(): TypedFetcherWithComponents<T>;
type FetcherArgs = Parameters<typeof useFetcher>[0];
export declare function useTypedFetcher<T>(opts?: FetcherArgs): TypedFetcherWithComponents<T>;
export declare function useTypedRouteLoaderData<T = AppData>(id: string): UseDataFunctionReturn<T> | undefined;

@@ -60,2 +61,3 @@ export type RemixSerializedType<T> = {

}
/** @deprecated */
export interface TypedMetaFunction<Loader extends LoaderFunction | unknown = unknown, ParentsLoaders extends Record<string, LoaderFunction> = {}> {

@@ -69,4 +71,4 @@ (args: {

location: Location;
}): HtmlMetaDescriptor;
}): MetaDescriptor;
}
export {};

@@ -91,4 +91,4 @@ "use strict";

exports.useTypedActionData = useTypedActionData;
function useTypedFetcher() {
const fetcher = (0, react_1.useFetcher)();
function useTypedFetcher(opts) {
const fetcher = (0, react_1.useFetcher)(opts);
if (fetcher.data) {

@@ -95,0 +95,0 @@ const newData = deserializeRemix(fetcher.data);

{
"name": "remix-typedjson",
"version": "0.3.1",
"version": "0.4.0",
"description": "This package is a replacement for superjson to use in your Remix app. It handles a subset of types that `superjson` supports, but is faster and smaller.",

@@ -38,23 +38,23 @@ "browser": "/dist/esm/index.js",

"devDependencies": {
"@babel/core": "^7.16.0",
"@babel/preset-env": "^7.16.4",
"@babel/preset-typescript": "^7.16.0",
"@remix-run/react": "^1.16.0",
"@remix-run/server-runtime": "^1.16.0",
"@types/jest": "^27.0.3",
"@types/react": "^18.0.25",
"@types/react-dom": "^18.0.8",
"all-contributors-cli": "^6.20.0",
"babel-jest": "^27.4.2",
"@babel/core": "^7.23.3",
"@babel/preset-env": "^7.23.3",
"@babel/preset-typescript": "^7.23.3",
"@remix-run/react": "^2.2.0",
"@remix-run/server-runtime": "^2.2.0",
"@types/jest": "^29.5.8",
"@types/react": "^18.2.37",
"@types/react-dom": "^18.2.15",
"all-contributors-cli": "^6.26.1",
"babel-jest": "^29.7.0",
"decimal.js": "^10.4.3",
"esbuild": "^0.14.38",
"esbuild-register": "^3.3.2",
"jest": "^27.4.3",
"prettier": "^2.7.1",
"esbuild": "^0.19.5",
"esbuild-register": "^3.5.0",
"jest": "^29.7.0",
"prettier": "^3.1.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"rimraf": "^3.0.2",
"ts-jest": "^27.0.7",
"rimraf": "^5.0.5",
"ts-jest": "^29.1.1",
"ts-node": "^10.4.0",
"typescript": "^4.6.4"
"typescript": "^5.1.6"
},

@@ -66,6 +66,4 @@ "jest": {

"peerDependencies": {
"@remix-run/react": "^1.16.0 || ^2.0",
"@remix-run/server-runtime": "^1.16.0 || ^2.0",
"react": "^17.0.2 || ^18.0.0"
}
}

@@ -164,2 +164,4 @@ # remix-typedjson

✨ Add support for `key` in v0.4.0
Replacement for Remix `useFetcher`. Use the generic `<typeof loader|action>` to

@@ -170,4 +172,4 @@ get the correct type inference for the `fetcher.data` property.

```js
const fetcher = useTypedFetcher<typeof action>()
```ts
const fetcher = useTypedFetcher<typeof action>({ key: 'abc' })
fetcher.data // data property is fully typed

@@ -182,4 +184,7 @@ ```

## `TypedMetaFunction`
## ~~`TypedMetaFunction`~~
🔥 Removed in v0.4.0 since it didn't actually work correctly. Will be replaced
with a `typedmeta` wrapper function in next release
You can now get typed arguments for both `data` and `parentsData` from your `meta`

@@ -186,0 +191,0 @@ function export. Based on [new feature coming to Remix](https://github.com/remix-run/remix/pull/4022)

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc