Files
react-native-devtools-frontend/front_end/core/platform/DevToolsPath.ts
T
Simon Zünd 4264c7b984 [platform] Add 'Brand' utility type for branded/tagged types
At this point we use the pattern enough to warrant an explicit
utility type to prevent minor code duplication.

R=kprokopenko@chromium.org

Bug: None
Change-Id: Idb83c32b8e5ca616d9335a24aef2dd8b44a5a052
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/4171285
Reviewed-by: Kateryna Prokopenko <kprokopenko@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
2023-01-16 12:28:37 +00:00

31 lines
923 B
TypeScript

// Copyright 2021 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import {type Brand} from './brand.js';
/**
* File paths in DevTools that are represented as URLs
* @example
* “file:///Hello%20World/file/js”
*/
export type UrlString = Brand<string, 'UrlString'>;
export const EmptyUrlString = '' as UrlString;
/**
* File paths in DevTools that are represented as unencoded absolute
* or relative paths
* @example
* “/Hello World/file.js”
*/
export type RawPathString = Brand<string, 'RawPathString'>;
export const EmptyRawPathString = '' as RawPathString;
/**
* File paths in DevTools that are represented as encoded paths
* @example
* “/Hello%20World/file.js”
*/
export type EncodedPathString = Brand<string, 'EncodedPathString'>;
export const EmptyEncodedPathString = '' as EncodedPathString;