introduce core-types

Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
Fredrik Adelöw
2021-10-21 09:45:32 +02:00
parent 00da5e919f
commit 41c49884d2
27 changed files with 350 additions and 89 deletions
+55
View File
@@ -0,0 +1,55 @@
/*
* Copyright 2021 The Backstage Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Temporarily re-export the JSON types from @backstage/core-types
import type {
JsonArray as CoreJsonArray,
JsonObject as CoreJsonObject,
JsonPrimitive as CoreJsonPrimitive,
JsonValue as CoreJsonValue,
} from '@backstage/core-types';
/**
* A type representing all allowed JSON primitive values.
*
* @public
* @deprecated Please use the same type from `@backstage/core-types` instead
*/
export type JsonPrimitive = CoreJsonPrimitive;
/**
* A type representing all allowed JSON object values.
*
* @public
* @deprecated Please use the same type from `@backstage/core-types` instead
*/
export type JsonObject = CoreJsonObject;
/**
* A type representing all allowed JSON array values.
*
* @public
* @deprecated Please use the same type from `@backstage/core-types` instead
*/
export type JsonArray = CoreJsonArray;
/**
* A type representing all allowed JSON values.
*
* @public
* @deprecated Please use the same type from `@backstage/core-types` instead
*/
export type JsonValue = CoreJsonValue;
+3 -4
View File
@@ -20,12 +20,11 @@
* @packageDocumentation
*/
export { ConfigReader } from './reader';
export type {
AppConfig,
Config,
JsonArray,
JsonObject,
JsonPrimitive,
JsonValue,
} from './types';
} from './deprecatedTypes';
export { ConfigReader } from './reader';
export type { AppConfig, Config } from './types';
+2 -1
View File
@@ -14,7 +14,8 @@
* limitations under the License.
*/
import { AppConfig, Config, JsonValue, JsonObject } from './types';
import { JsonValue, JsonObject } from '@backstage/core-types';
import { AppConfig, Config } from './types';
import cloneDeep from 'lodash/cloneDeep';
import mergeWith from 'lodash/mergeWith';
+1 -27
View File
@@ -14,33 +14,7 @@
* limitations under the License.
*/
/**
* A type representing all allowed JSON primitive values.
*
* @public
*/
export type JsonPrimitive = number | string | boolean | null;
/**
* A type representing all allowed JSON object values.
*
* @public
*/
export type JsonObject = { [key in string]?: JsonValue };
/**
* A type representing all allowed JSON array values.
*
* @public
*/
export interface JsonArray extends Array<JsonValue> {}
/**
* A type representing all allowed JSON values.
*
* @public
*/
export type JsonValue = JsonObject | JsonArray | JsonPrimitive;
import { JsonObject, JsonValue } from '@backstage/core-types';
/**
* A serialized form of configuration data that carries additional context.