Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -820,9 +820,7 @@ moduleFor(
assert
) {
class TestManager {
capabilities = componentCapabilities('3.13', {
/* implied: updateHook: false */
});
capabilities = componentCapabilities('3.13', {/* implied: updateHook: false */});

createComponent() {
assert.step('createComponent');
Expand Down
3 changes: 1 addition & 2 deletions packages/@ember/-internals/utils/lib/mandatory-setter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import type { Tag } from '@glimmer/interfaces';
import lookupDescriptor from './lookup-descriptor';

export let setupMandatorySetter:
| ((tag: Tag, obj: object, keyName: string | symbol) => void)
| undefined;
((tag: Tag, obj: object, keyName: string | symbol) => void) | undefined;
export let teardownMandatorySetter: ((obj: object, keyName: string | symbol) => void) | undefined;
export let setWithMandatorySetter: ((obj: object, keyName: string, value: any) => void) | undefined;

Expand Down
4 changes: 1 addition & 3 deletions packages/@ember/controller/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ import type { Transition } from 'router_js';

export type ControllerQueryParamType = 'boolean' | 'number' | 'array' | 'string';
export type ControllerQueryParam =
| string
| Record<string, { type: ControllerQueryParamType }>
| Record<string, string>;
string | Record<string, { type: ControllerQueryParamType }> | Record<string, string>;

const MODEL = Symbol('MODEL');

Expand Down
4 changes: 2 additions & 2 deletions packages/@ember/engine/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ class Engine extends Namespace.extend(RegistryProxyMixin) {

_runInitializer<
B extends 'initializers' | 'instanceInitializers',
T extends B extends 'initializers' ? Engine : EngineInstance,
T extends (B extends 'initializers' ? Engine : EngineInstance),
>(bucketName: B, cb: (name: string, initializer: Initializer<T> | undefined) => void) {
let initializersByName = get(this.constructor, bucketName) as Record<string, Initializer<T>>;
let initializers = props(initializersByName);
Expand Down Expand Up @@ -481,7 +481,7 @@ function resolverFor(namespace: Engine) {
/** @internal */
export function buildInitializerMethod<
B extends 'initializers' | 'instanceInitializers',
T extends B extends 'initializers' ? Engine : EngineInstance,
T extends (B extends 'initializers' ? Engine : EngineInstance),
>(bucketName: B, humanName: string) {
return function (this: typeof Engine, initializer: Initializer<T>) {
// If this is the first initializer being added to a subclass, we are going to reopen the class
Expand Down
3 changes: 1 addition & 2 deletions packages/@ember/object/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,7 @@ type ObserverDefinition<T extends AnyFn> = {
*/
export function observer<T extends AnyFn>(
...args:
| [propertyName: string, ...additionalPropertyNames: string[], func: T]
| [ObserverDefinition<T>]
[propertyName: string, ...additionalPropertyNames: string[], func: T] | [ObserverDefinition<T>]
): T {
let funcOrDef = args.pop();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -550,8 +550,7 @@ export function filter(
export function filter(
dependentKey: string,
additionalDependentKeysOrCallback:
| string[]
| ((value: unknown, index: number, array: unknown[] | EmberArray<unknown>) => unknown),
string[] | ((value: unknown, index: number, array: unknown[] | EmberArray<unknown>) => unknown),
callback?: (value: unknown, index: number, array: unknown[] | EmberArray<unknown>) => unknown
): PropertyDecorator {
assert(
Expand Down
3 changes: 1 addition & 2 deletions packages/@ember/object/observable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ import Mixin from '@ember/object/mixin';
import { assert } from '@ember/debug';

export type ObserverMethod<Target, Sender> =
| keyof Target
| ((this: Target, sender: Sender, key: string, value: any, rev: number) => void);
keyof Target | ((this: Target, sender: Sender, key: string, value: any, rev: number) => void);

/**
## Overview
Expand Down
4 changes: 1 addition & 3 deletions packages/@ember/routing/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1209,9 +1209,7 @@ class Route<Model = unknown> extends EmberObject.extend(ActionHandler, Evented)
}
// SAFETY: This should be correct, but TS is unable to infer this.
return transition[STATE_SYMBOL]!.routeInfos[transition.resolveIndex - 1]!.context as
| Model
| PromiseLike<Model>
| undefined;
Model | PromiseLike<Model> | undefined;
}
}

Expand Down
2 changes: 1 addition & 1 deletion packages/@ember/runloop/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ export function bind<F extends AnyFn, A extends PartialParams<Parameters<F>>>(
export function bind<
T,
U extends keyof T,
A extends T[U] extends AnyFn ? PartialParams<Parameters<T[U]>> : [],
A extends (T[U] extends AnyFn ? PartialParams<Parameters<T[U]>> : []),
>(
target: T,
method: U,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,7 @@ class ContentTest extends RenderTest {
// swapping between unsafe and safe

type ContentValue =
| string
| SafeString
| null
| undefined
| number
| boolean
| Element
| DocumentFragment;
string | SafeString | null | undefined | number | boolean | Element | DocumentFragment;

interface ContentTestCase {
name: string;
Expand Down
23 changes: 4 additions & 19 deletions packages/@glimmer/compiler/lib/builder/builder-interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -532,18 +532,12 @@ function mapObject<T extends Dict, Out>(
}

export type BuilderElement =
| [string]
| [string, BuilderAttrs, BuilderBlock]
| [string, BuilderBlock]
| [string, BuilderAttrs];
[string] | [string, BuilderAttrs, BuilderBlock] | [string, BuilderBlock] | [string, BuilderAttrs];

export type BuilderComment = [BUILDER_COMMENT, string];

export type InvocationElement =
| [string]
| [string, BuilderAttrs, BuilderBlock]
| [string, BuilderBlock]
| [string, BuilderAttrs];
[string] | [string, BuilderAttrs, BuilderBlock] | [string, BuilderBlock] | [string, BuilderAttrs];

export function isElement(input: [string, ...unknown[]]): input is BuilderElement {
const match = /^<([\d\-a-z][\d\-A-Za-z]*)>$/u.exec(input[0]);
Expand Down Expand Up @@ -580,10 +574,7 @@ export type VerboseStatement =
| [BUILDER_DYNAMIC_COMPONENT, BuilderExpression, Hash, BuilderBlock];

export type BuilderStatement =
| VerboseStatement
| SugaryArrayStatement
| TupleBuilderExpression
| string;
VerboseStatement | SugaryArrayStatement | TupleBuilderExpression | string;

/**
* The special value 'splat' is used to indicate that the attribute is a splat
Expand Down Expand Up @@ -818,13 +809,7 @@ export function normalizeExpression(expression: BuilderExpression): NormalizedEx
// | [HAS_BLOCK_PARAMS, string]

export type BuilderExpression =
| TupleBuilderExpression
| BuilderCallExpression
| null
| undefined
| boolean
| string
| number;
TupleBuilderExpression | BuilderCallExpression | null | undefined | boolean | string | number;

export function isBuilderExpression(
expr: BuilderExpression | BuilderCallExpression
Expand Down
7 changes: 1 addition & 6 deletions packages/@glimmer/compiler/lib/builder/builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -522,12 +522,7 @@ export function buildAttributeValue(
}

type ExprResolution =
| VariableResolutionContext
| 'Append'
| 'TrustedAppend'
| 'AttrValue'
| 'SubExpression'
| 'Strict';
VariableResolutionContext | 'Append' | 'TrustedAppend' | 'AttrValue' | 'SubExpression' | 'Strict';

function varContext(context: ExprResolution, bare: boolean): VarResolution {
switch (context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,7 @@ export type KeywordMatch = KeywordMatches[keyof KeywordMatches];
export type GenericKeywordNode = ASTv2.AppendContent | ASTv2.CallExpression;

export type KeywordNode =
| GenericKeywordNode
| ASTv2.CallExpression
| ASTv2.InvokeBlock
| ASTv2.ElementModifier;
GenericKeywordNode | ASTv2.CallExpression | ASTv2.InvokeBlock | ASTv2.ElementModifier;

export type PossibleKeyword = KeywordNode;
type OutFor<K extends Keyword | BlockKeyword> =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,7 @@ export class ExpressionEncoder {
isTemplateLocal,
symbol,
}: ASTv2.LocalVarReference):
| WireFormat.Expressions.GetSymbol
| WireFormat.Expressions.GetLexicalSymbol {
WireFormat.Expressions.GetSymbol | WireFormat.Expressions.GetLexicalSymbol {
return [isTemplateLocal ? SexpOpcodes.GetLexicalSymbol : SexpOpcodes.GetSymbol, symbol];
}

Expand Down
3 changes: 2 additions & 1 deletion packages/@glimmer/component/src/-private/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ type ArgsFor<S> = S extends { Args: infer Args }

type _ExpandSignature<T> = {
Element: GetOrElse<T, 'Element', null>;
Args: keyof T extends 'Args' | 'Element' | 'Blocks' // Is this a `Signature`?
Args: keyof T extends
'Args' | 'Element' | 'Blocks' // Is this a `Signature`?
? ArgsFor<T> // Then use `Signature` args
: { Named: T; Positional: [] }; // Otherwise fall back to classic `Args`.
Blocks: T extends { Blocks: infer Blocks }
Expand Down
14 changes: 6 additions & 8 deletions packages/@glimmer/debug/lib/debug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,14 +223,12 @@ type DefineOperand<T extends string, V, Options = undefined> = undefined extends
: readonly [type: T, value: V, options: Options];

type DefineNullableOperand<T extends string, V, Options = undefined> = Options extends undefined
?
| readonly [type: T, value: V]
| readonly [type: T, value: Nullable<V>, options: { nullable: true }]
| readonly [type: T, value: V, options: { nullable?: false }]
:
| readonly [type: T, value: Nullable<V>, options: Expand<Options & { nullable: true }>]
| readonly [type: T, value: V, options: Expand<Options & { nullable?: false }>]
| readonly [type: T, value: V, options: Options];
? | readonly [type: T, value: V]
| readonly [type: T, value: Nullable<V>, options: { nullable: true }]
| readonly [type: T, value: V, options: { nullable?: false }]
: | readonly [type: T, value: Nullable<V>, options: Expand<Options & { nullable: true }>]
| readonly [type: T, value: V, options: Expand<Options & { nullable?: false }>]
| readonly [type: T, value: V, options: Options];

/**
* A dynamic operand has a value that can't be easily represented as an embedded string.
Expand Down
25 changes: 7 additions & 18 deletions packages/@glimmer/debug/lib/dism/dism.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,7 @@ import type { NormalizedOperand } from './operand-types';

export type Primitive = undefined | null | boolean | number | string;
export type RegisterName =
| '$pc'
| '$ra'
| '$fp'
| '$sp'
| '$s0'
| '$s1'
| '$t0'
| '$t1'
| '$v0'
| `$bug${number}`;
'$pc' | '$ra' | '$fp' | '$sp' | '$s0' | '$s1' | '$t0' | '$t1' | '$v0' | `$bug${number}`;

export type StaticDisassembledOperand = ObjectForRaw<RawStaticDisassembledOperand> & {
isDynamic: false;
Expand All @@ -31,14 +22,12 @@ type DefineOperand<T extends string, V, Options = undefined> = undefined extends
: readonly [type: T, value: V, options: Options];

type DefineNullableOperand<T extends string, V, Options = undefined> = Options extends undefined
?
| readonly [type: T, value: V]
| readonly [type: T, value: Nullable<V>, options: { nullable: true }]
| readonly [type: T, value: V, options: { nullable?: false }]
:
| readonly [type: T, value: Nullable<V>, options: Expand<Options & { nullable: true }>]
| readonly [type: T, value: V, options: Expand<Options & { nullable?: false }>]
| readonly [type: T, value: V, options: Options];
? | readonly [type: T, value: V]
| readonly [type: T, value: Nullable<V>, options: { nullable: true }]
| readonly [type: T, value: V, options: { nullable?: false }]
: | readonly [type: T, value: Nullable<V>, options: Expand<Options & { nullable: true }>]
| readonly [type: T, value: V, options: Expand<Options & { nullable?: false }>]
| readonly [type: T, value: V, options: Options];

/**
* A dynamic operand has a value that can't be easily represented as an embedded string.
Expand Down
10 changes: 2 additions & 8 deletions packages/@glimmer/debug/lib/render/fragment-type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ export interface ValueFragment extends AbstractLeafFragment {
* The `display` property can be provided to override these defaults.
*/
readonly display?:
| { ref: string; footnote?: Fragment | undefined }
| { inline: Fragment }
| undefined;
{ ref: string; footnote?: Fragment | undefined } | { inline: Fragment } | undefined;
}

/**
Expand Down Expand Up @@ -90,11 +88,7 @@ export interface SpecialFragment extends AbstractLeafFragment {
* format specifiers.
*/
export type LeafFragmentType =
| StringFragment
| IntegerFragment
| FloatFragment
| ValueFragment
| SpecialFragment;
StringFragment | IntegerFragment | FloatFragment | ValueFragment | SpecialFragment;

export type FragmentType =
| LeafFragmentType
Expand Down
3 changes: 1 addition & 2 deletions packages/@glimmer/global-context/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,7 @@ export default function setGlobalContext(context: GlobalContext) {

export let assertGlobalContextWasSet: (() => void) | undefined;
export let testOverrideGlobalContext:
| ((context: Partial<GlobalContext> | null) => GlobalContext | null)
| undefined;
((context: Partial<GlobalContext> | null) => GlobalContext | null) | undefined;

if (DEBUG) {
assertGlobalContextWasSet = () => {
Expand Down
9 changes: 1 addition & 8 deletions packages/@glimmer/interfaces/lib/compile/operands.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,7 @@ export type HighLevelBuilderOperand =
| LayoutOperand;

export type SingleBuilderOperand =
| HighLevelBuilderOperand
| number
| string
| boolean
| undefined
| null
| number[]
| string[];
HighLevelBuilderOperand | number | string | boolean | undefined | null | number[] | string[];

export type Operand = number;

Expand Down
13 changes: 2 additions & 11 deletions packages/@glimmer/interfaces/lib/compile/wire-format/api.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,13 +188,7 @@ export type StyleAttr = 5;
export type HrefAttr = 6;

export type WellKnownAttrName =
| ClassAttr
| IdAttr
| ValueAttr
| NameAttr
| TypeAttr
| StyleAttr
| HrefAttr;
ClassAttr | IdAttr | ValueAttr | NameAttr | TypeAttr | StyleAttr | HrefAttr;

export type DivTag = 0;
export type SpanTag = 1;
Expand Down Expand Up @@ -250,10 +244,7 @@ export namespace Statements {
export type TrustingComponentAttr = Attr<TrustingComponentAttrOpcode>;

export type AnyDynamicAttr =
| DynamicAttr
| ComponentAttr
| TrustingDynamicAttr
| TrustingComponentAttr;
DynamicAttr | ComponentAttr | TrustingDynamicAttr | TrustingComponentAttr;

export type Debugger = [
op: DebuggerOpcode,
Expand Down
5 changes: 1 addition & 4 deletions packages/@glimmer/interfaces/lib/references.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@ export interface ReferenceTypes {
}

export type ReferenceType =
| ConstantReference
| ComputeReference
| UnboundReference
| InvokableReference;
ConstantReference | ComputeReference | UnboundReference | InvokableReference;

declare const REFERENCE: unique symbol;
export type ReferenceSymbol = typeof REFERENCE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,7 @@ import type { Bounds } from '../dom/bounds.js';
import type { Arguments, CapturedArguments } from './arguments.js';

export type RenderNodeType =
| 'outlet'
| 'engine'
| 'route-template'
| 'component'
| 'modifier'
| 'keyword';
'outlet' | 'engine' | 'route-template' | 'component' | 'modifier' | 'keyword';

export interface RenderNode {
type: RenderNodeType;
Expand Down
5 changes: 1 addition & 4 deletions packages/@glimmer/interfaces/lib/tags.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@ export type CONSTANT_TAG_ID = 3;
* be added to the monomorphic tag.
*/
export type MonomorphicTagId =
| DIRTYABLE_TAG_ID
| UPDATABLE_TAG_ID
| COMBINATOR_TAG_ID
| CONSTANT_TAG_ID;
DIRTYABLE_TAG_ID | UPDATABLE_TAG_ID | COMBINATOR_TAG_ID | CONSTANT_TAG_ID;

export type VOLATILE_TAG_ID = 100;
export type CURRENT_TAG_ID = 101;
Expand Down
5 changes: 1 addition & 4 deletions packages/@glimmer/manager/lib/internal/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ import { CustomHelperManager } from '../public/helper';
import { FunctionHelperManager } from './defaults';

type InternalManager =
| InternalComponentManager
| InternalModifierManager
| CustomHelperManager
| Helper;
InternalComponentManager | InternalModifierManager | CustomHelperManager | Helper;

const COMPONENT_MANAGERS = new WeakMap<object, InternalComponentManager>();

Expand Down
Loading
Loading