Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: include service and definition types with implementations #552

Merged
merged 1 commit into from
May 1, 2022

Conversation

niedzielski
Copy link
Contributor

When exporting a service or service definition, also export it as a
type. Previously, you would have to import the value then typeof off
of it which is cumbersome. Automate this as it has no runtime overhead
and seems more intuitive.

Before:

export const TestDefinition = {
  name: 'Test',
  fullName: 'simple.Test',
  methods: {},
} as const;

After:

export type TestDefinition = typeof TestDefinition;
export const TestDefinition = {
  name: 'Test',
  fullName: 'simple.Test',
  methods: {},
} as const;

When exporting a service or service definition, also export it as a
type. Previously, you would have to import the value then `typeof` off
of it which is cumbersome. Automate this as it has no runtime overhead
and seems more intuitive.

Before:

```ts
export const TestDefinition = {
  name: 'Test',
  fullName: 'simple.Test',
  methods: {
    …
  },
} as const;
```

After:

```ts
export type TestDefinition = typeof TestDefinition;
export const TestDefinition = {
  name: 'Test',
  fullName: 'simple.Test',
  methods: {
    …
  },
} as const;
```
@fizx fizx requested review from fizx and stephenh April 28, 2022 18:40
@fizx
Copy link
Collaborator

fizx commented Apr 28, 2022

Hi @stephenh,
Code looks good here, and it's a useful feature, but I was holding off on merging it because it's from someone on my work team, and we haven't chatted yet about whether you feel that represents a conflict of interest on my review.

Thanks!

Copy link
Collaborator

@fizx fizx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

Copy link
Owner

@stephenh stephenh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Thanks @niedzielski !

Sorry for the really late review here; have just been busy. Fwiw @fizx yeah I'm perfectly happy with you + other maintainers (cc @boukeversteegh who's been actively lately as well) reviewing and merging PRs, to keep me from being the bottleneck on the project.

@stephenh stephenh merged commit 6b896f4 into stephenh:main May 1, 2022
stephenh pushed a commit that referenced this pull request May 1, 2022
# [1.111.0](v1.110.4...v1.111.0) (2022-05-01)

### Features

* include service and definition types with implementations ([#552](#552)) ([6b896f4](6b896f4))
@stephenh
Copy link
Owner

stephenh commented May 1, 2022

🎉 This PR is included in version 1.111.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants