packages/core: add missing types for apis

This commit is contained in:
Patrik Oldsberg
2020-04-23 11:03:43 +02:00
parent d47d09eeb1
commit 8777ee7487
3 changed files with 9 additions and 6 deletions
@@ -29,7 +29,7 @@ export type AlertApi = {
/**
* Post an alert for handling by the application.
*/
post(alert: AlertMessage);
post(alert: AlertMessage): void;
};
export const alertApiRef = new ApiRef<AlertApi>({
@@ -53,7 +53,7 @@ export type ErrorApi = {
/**
* Post an error for handling by the application.
*/
post(error: Error, context?: ErrorContext);
post(error: Error, context?: ErrorContext): void;
};
export const errorApiRef = new ApiRef<ErrorApi>({
@@ -15,7 +15,10 @@
*/
import { FeatureFlags as FeatureFlagsImpl } from './FeatureFlags';
import { FeatureFlagState } from 'api/apis/definitions/featureFlags';
import {
FeatureFlagState,
FeatureFlagsApi,
} from 'api/apis/definitions/featureFlags';
describe('FeatureFlags', () => {
beforeEach(() => {
@@ -23,7 +26,7 @@ describe('FeatureFlags', () => {
});
describe('#getFlags', () => {
let featureFlags;
let featureFlags: FeatureFlagsApi;
beforeEach(() => {
featureFlags = new FeatureFlagsImpl();
@@ -121,7 +124,7 @@ describe('FeatureFlags', () => {
});
describe('#getRegisteredFlags', () => {
let featureFlags;
let featureFlags: FeatureFlagsApi;
beforeEach(() => {
featureFlags = new FeatureFlagsImpl();
@@ -146,7 +149,7 @@ describe('FeatureFlags', () => {
});
it('should get the correct values', () => {
const getByName = name =>
const getByName = (name: string) =>
featureFlags.getRegisteredFlags().find(flag => flag.name === name);
expect(getByName('registered-flag-0')).toBeUndefined();