import types which import another types don't seems to work
parweb opened this issue · 2 comments
parweb commented
setup
src
├── phero.ts
└── types
├── Permission.ts
└── User.ts
src/phero.ts
import { createService } from '@phero/server';
import { User } from './types/User';
async function update(data: Omit<User, 'email'>): Promise<User> {
return { email: '', permissions: { allow: true } };
}
export const user = createService({
update
});
src/types/Permission.ts
export interface Permission {
allow: boolean;
}
src/types/User.ts
import { Permission } from '../types/Permission';
export interface User {
email: string;
permissions?: Permission;
}
issue
error TS-PheroError:
S145: ParserModel not implemented yet:
`import(".../src/types/Permission").Permission` (kind:200)
work around
add depedencies import { Permission } from './types/Permission';
but not used anywhere in this file
src/phero.ts
import { createService } from '@phero/server';
import { User } from './types/User';
// this is the work around
import { Permission } from './types/Permission';
async function update(data: Omit<User, 'email'>): Promise<User> {
return { email: '', permissions: { allow: true } };
}
export const user = createService({
update
});
working
If I use the type User
as it is everything work as intended
src/phero.ts
import { createService } from '@phero/server';
import { User } from './types/User';
async function update(data: User): Promise<User> {
// └── simple type
return { email: '', permissions: { allow: true } };
}
export const user = createService({
update
});
kamilafsar commented
Thanks for reporting @parweb
Will look into this asap!
kamilafsar commented
@parweb With the release of v0.10.0 this should be fixed. Closing this ticket. Would be great if you could give it another go. :) Please feel free to reopen if you still encounter issues.