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(as const): allow to declare tokens as const #27

Merged
merged 1 commit into from Aug 12, 2020
Merged

Conversation

nicojs
Copy link
Owner

@nicojs nicojs commented Aug 12, 2020

Allow to declare tokens as const.

This:

class Foo {
  static inject = tokens('bar');
}

Can now also be specified as:

class Foo {
  static inject = ['bar'] as const;
}

Fixes #23

BREAKING CHANGE: The typed-inject is now expecting tokens to be provided in a readonly array. You can either use as const or the tokens helper function for it.

Allow to declare tokens as const.

This:

```ts
class Foo {
  static inject = tokens('bar');
}
```

Can now also be specified as:

```ts
class Foo {
  static inject = ['bar'] as const;
}
```

BREAKING CHANGE: The typed-inject is now expecting tokens to be provided in a `readonly` array. You can either use `as const` or the `tokens` helper function for it.
@nicojs nicojs merged commit 05435b7 into master Aug 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support as const syntax for injection tokens
1 participant