Skip to content

Commit

Permalink
chore: Rename createResourceRouter -> createTypedRouter
Browse files Browse the repository at this point in the history
Signed-off-by: Jorgen Ader <[email protected]>
  • Loading branch information
jorgenader committed Nov 19, 2024
1 parent dcbc1c1 commit fa37dd4
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { RouteMap, RouterInterface } from '../types';
import { RouterBuilder } from './builder';
import { CreateResourceRouterOptions } from './types';

export function createResourceRouter<
export function createTypedRouter<
Klass extends Resource<any, any, any, any>,
Definitions extends RouteMap
>(
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/router-builder/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export * from './createResourceRouter';
export * from './createTypedRouter';

export * from './types';

Expand Down
4 changes: 2 additions & 2 deletions packages/core/test-d/createResourceRouter.types.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { expectType } from 'tsd';

import {
createResourceRouter,
createTypedRouter,
ResourceInterface,
} from '../src';
import { DummyResource } from '../src/DummyResource';
Expand All @@ -11,7 +11,7 @@ interface Animal {
name: string;
}

const api = createResourceRouter({
const api = createTypedRouter({
resource: DummyResource,
config: {
apiRoot: '/api/v1', // Set api root
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import 'jest-extended';

import { createResourceRouter } from '../src';
import { createTypedRouter } from '../src';
import DEFAULTS from '../src/constants';
import { DummyResource } from '../src/DummyResource';

describe('createRouter :: invalid type used', () => {
test('invalid type :: top level', () => {
expect(() => {
createResourceRouter({
createTypedRouter({
resource: DummyResource,
config: null,
routerBuilder: (builder) => ({
Expand All @@ -19,7 +19,7 @@ describe('createRouter :: invalid type used', () => {

test('invalid type :: nested', () => {
expect(() => {
createResourceRouter({
createTypedRouter({
resource: DummyResource,
config: null,
routerBuilder: (builder) => ({
Expand All @@ -33,7 +33,7 @@ describe('createRouter :: invalid type used', () => {
});

describe('createRouter :: string map', () => {
const api = createResourceRouter({
const api = createTypedRouter({
resource: DummyResource,
config: { root: true },
routerBuilder: (builder) => ({
Expand Down Expand Up @@ -166,7 +166,7 @@ describe('createRouter :: string map', () => {
});

describe('createRouter :: resource tuple', () => {
const api = createResourceRouter({
const api = createTypedRouter({
resource: DummyResource,
config: null,
routerBuilder: (builder) => ({
Expand Down Expand Up @@ -209,7 +209,7 @@ describe('createRouter :: resource tuple', () => {
});

describe('createRouter :: resource constructor', () => {
const api = createResourceRouter({
const api = createTypedRouter({
resource: DummyResource,
config: { level: 0 },
routerBuilder: (builder) => ({
Expand Down

0 comments on commit fa37dd4

Please sign in to comment.