Add support for literal type subtraction

Now we have Mapped Types and keyof, we could add a subtraction operator that only works on literal types:
type Omit<T, K extends keyof T> = {
    [P in keyof T - K]: T[P];
};

type Overwrite<T, K> = K & {
    [P in keyof T - keyof K]: T[P];
};

type Item1 = { a: string, b: number, c: boolean };
type Item2 = { a: number };

type T1 = Omit<Item1, "a"> // { b: number, c: boolean };
type T2 = Overwrite<Item1, Item2> // { a: number, b: number, c: boolean };

Duplicate of 4183?

I'm going to relabel this a suggestion as #4183 doesn't actually have a proposal.

@ahejlsberg checkout my proposal at #4183

Hope to see this soon, will be a huge improvement too!

Note that keyof T may be string or number or string | number (depending on available indexers), and therefore the behavior of string - 'foo' will need to be defined.

Note that keyof T may be string or number or string | number (depending on available indexers), and therefore the behavior of string - 'foo', and number - '1', etc. will need to be defined.

this is not accurate. keyof is always a string.

If there are any questions about use cases, this would be incredibly helpful for typing Redux, Recompose, and other higher order component libraries for React. For instance, wrapping an uncontrolled dropdown in a withState HOC removes the need for isOpen or toggle props, without the need to manually specify a type.
Redux's connect() similarly wraps and supplies some/all props to a component, leaving a subset of the original interface.

Poor man's Omit:
type Omit<A, B extends keyof A> = A & {
  [P in keyof A & B]: void
}

The "omitted" key is still there, however mostly unusable, since it's type is T & void, and nothing sane can satisfy this constraint. It won't prevent you from accessing T & void, but it will prevent you from assigning it or using it as a parameter in a function.
Once https://github.com/Microsoft/TypeScript/pull/13470 lands, we can do even better.

@niieani That solution won't work for react HoC that inject props.
If you use this pattern to "remove" props, the typechecker will still complain if you omit them when using a component:

  [P in keyof A & B]: void
}

class Foo extends React.Component<{a:string, b:string}, void> {
}

type InjectedPops = {a: any}
function injectA<Props extends InjectedPops>(x:React.ComponentClass<Props>):React.ComponentClass<Omit<Props, 'a'>>{
  return x as any
}

const Bar = injectA(Foo)

var x = <Bar b=''/>
// Property 'a' is missing in type 'IntrinsicAttributes & IntrinsicClassAttributes<Component<Omit<{ a: string; b: string; }, "a">, Co...'.

I think this one would be easier to realise in the following form:
[P in keyof A - B] should work only if A extends B, and return all keys that are in A and are not in B.
type Omit<A extends B, B> = {
  [P in keyof A - B]: P[A]
}

type Impossible<A, B> = {
 [P in keyof A - B]: string
} /* ERROR: A doesn't extend B */

interface IFoo {
   foo: string
}

interface IFooBar extends IFoo {
  bar: string
}

type IBar = Omit<IFooBar, IFoo>; // { bar: string }

Since we cannot change types of fields when extending, all inconsistencies (a.k.a) string - 'world' would go away.

Overwrite seems covered by #10727. This proposal seems an alternate syntax for #13470?

#13470 is not the same, since it does not allow you to dynamically create difference types.

Overwrite using today's syntax:
type Item1 = { a: string, b: number, c: boolean };
type Item2 = { a: number };

type ObjHas<Obj extends {}, K extends string> = ({[K in keyof Obj]: 1 } & { [k: string]: 0 })[K];
type Overwrite<K, T> = {[P in keyof T | keyof K]: { 1: T[P], 0: K[P] }[ObjHas<T, P>]};
// ^ yields '... cannot be used to index type ...' (can't see `ObjHas` always returns a number), yet still works in Playground

type T2 = Overwrite<Item1, Item2> // { a: number, b: number, c: boolean };

I also tried my hand at Omit, if with mixed success:
// helpers...
type Obj<T> = { [k: string]: T };
type SafeObj<O extends { [k: string]: any }, Name extends string, Param extends string> = O & Obj<{[K in Name]: Param }>;
type SwitchObj<Param extends string, Name extends string, O extends Obj<any>> = SafeObj<O, Name, Param>[Param];
type Not<T extends string> = SwitchObj<T, 'InvalidNotParam', {
  '1': '0';
  '0': '1';
}>;
type UnionHas<Union extends string, K extends string> = ({[S in Union]: '1' } & { [k: string]: '0' })[K];
type Obj2Keys<T> = {[K in keyof T]: K } & { [k: string]: undefined };

// data...
type Item1 = { a: string, b: number, c: boolean };

// okay, Omit, let's go.
type Omit_<T extends { [s: string]: any }, K extends keyof T> =
  {[P2 in keyof T]: { 1: Obj2Keys<T>[P2], 0: undefined }[Not<UnionHas<K, P2>>]}
type T1 = Omit_<Item1, "a">;
// intermediary result: { a: undefined; b: "b"; c: "c"; }
type T2 = {[P1 in T1[keyof Item1] ]: Item1[P1]}; // { b: number, c: boolean };
// ^ great, the result we want!

Wonderful, yet another problem solved!
...
// now let's combine the steps?!
type Omit<T extends { [s: string]: any }, K extends keyof T> =
  {[P1 in {[P2 in keyof T]: { 1: Obj2Keys<T>[P2], 0: undefined }[Not<UnionHas<K, P2>>]}[keyof T] ]: T[P1]};
type T3 = Omit<Item1, "a">;
// ^ yields { a: string, b: number, c: boolean }, not { b: number, c: boolean }
// uh, could we instead do the next step in a separate wrapper type?:
type Omit2<T extends { [s: string]: any }, K extends keyof T> = Omit_<T, K>[keyof T];
// ^ not complete yet, but this is the minimum repro of the part that's going wrong
type T4 = Omit2<Item1, "a">;
// ^ nope, foiled again! 'a'|'b'|'c' instead of 'b'|'c'... wth?
// fails unless this access step is done after the result is calculated, dunno why

Note that my attempt to calculate union differences in #13470 suffered from the same problem... any TypeScript experts in here? 😄

@tycho01 what you're doing here is amazing. I've played around with it a bit and the 1-step behavior does seem like a bug in TypeScript. I think if you file a separate bug report about it, we could get it solved and have a wonderful one-step Omit and Overwrite! :)

@niieani: yeah, issue filed at #16244 now.
I'd scribbled a bit on current my understanding/progress on TS type operations; just put a pic here.
It's like, we can do boolean-like operations with strings, and for unions/object operations the current frontier is overcoming this difference glitch.
Operations on actual primitives currently seem off the table though, while for tuple types things are still looking tough as well -- we can get union/object representations using keyof / Partial, and hopefully difference will work that way too.
But things like converting those back to tuple types, or just straight type-level ... destructuring, aren't possible yet.
When we do, we may get to type-level iteration for reduce-like operations, where things get a lot more interesting imo.
That said, this Omit still gets another problem with strictNullChecks on. Currently it relies on mapping bad keys to undefined so as to get rid of them.
Without strictNullChecks that works by default, but with that on, we need to get rid of them explicitly.
The good news is there is this assertion operator ! which does exactly that, but the bad news is it's not exposed on the type level yet.

@tycho01 ,
Amazing thing indeed!!
I played with it a bit, what do you think about this solution?
type Obj<T> = { [k: string]: T };
type SafeObj<O extends { [k: string]: any }, Name extends string, Param extends string> = O & Obj<{[K in Name]: Param }>;
type SwitchObj<Param extends string, Name extends string, O extends Obj<any>> = SafeObj<O, Name, Param>[Param];
type Not<T extends string> = SwitchObj<T, 'InvalidNotParam', {
  '1': '0';
  '0': '1';
}>;
type UnionHas<Union extends string, K extends string> = ({[S in Union]: '1' } & { [k: string]: '0' })[K];
type Obj2Keys<T> = {[K in keyof T]: K } & { [k: string]: never };

type Omit_<T extends { [s: string]: any }, K extends keyof T> =
  {[P2 in keyof T]: { 1: Obj2Keys<T>[P2], 0: never }[Not<UnionHas<K, P2>>]}

export type Omit<T extends { [s: string]: any }
    , K extends keyof T
    , T1 extends Omit_<T, K>= Omit_<T, K>
    , T1K extends keyof Pick<T1, keyof T>=keyof Pick<T1, keyof T>> =
    {[P1 in T1[T1K]]: T[P1]}
  ;

type Item1 = { a: string, b: number, c: boolean };

const ommited: Omit<Item1, 'a'> = {
  b: 6,
  c: true,
}

@nirendy seems to be working for me! 👍
@tycho01 great job on solving the strictNullChecks issue.

@niieani: you can thank @jaen for that, see #13470. 😃
@nirendy: whoa! I hadn't realized we can use this defaults syntax like that. the repetition feels a bit awkward, but being able to save/reuse results and check them for debugging purposes is pretty awesome!
That said... separating the steps here was one thing, but also swapping out the [keyof T] for that keyof Pick<>? How did you ever figure any of this out?! 😆

that's amaze balls guys, how did you do it?

@tycho01
I feel like there is no way to avoid that repetition there (while using the current version tools) since it plays a different role each time (once it's there to make sure the generic actually extends the type and the other one is there in order to omit the need of providing all the generics params).
Any way, I think we managed to achieve an amazing thing!
It doesn't really matter to me that the code came out pretty awkward, I'll just place it in a declaration file and use it in a similar way of how I use the Pick, Partial, etc... types.
Amazing!

@nirendy: yeah, no complaints here! 😃

Some fun stuff here. I just merged #16446 which allows an even simpler solution:
type Diff<T extends string, U extends string> = ({ [P in T]: P } & { [P in U]: never } & { [x: string]: never })[T];
type Omit<T, K extends keyof T> = { [P in Diff<keyof T, K>]: T[P] };
type Overwrite<T, U> = { [P in Diff<keyof T, keyof U>]: T[P] } & U;

type T1 = Diff<"a" | "b" | "c", "c" | "d">;  // "a" | "b"

type Item1 = { a: string, b: number, c: boolean };
type Item2 = { a: number };

type T2 = Omit<Item1, "a"> // { b: number, c: boolean };
type T3 = Overwrite<Item1, Item2> // { a: number, b: number, c: boolean };

The Diff type is effectively a subtraction operator for string literal types. It relies on the following type equivalences:

T | never = T
T & never = never (which #16446 provides)

Furthermore, it relies on the fact that an object with a string index signature can be indexed with any string.
A native literal subtraction operator should include certain higher order type relationships. For example T - U should be considered a subtype of T, and { [P in keyof T - U]: T[P] } should be considered a supertype of T. The Diff type doesn't have those, so type assertions may in some cases be necessary.

I noticed a small technical difference in that the cleaner Overwrite definition yields an intersection type:
type Diff<T extends string, U extends string> = ({ [P in T]: P } & { [P in U]: never } & { [x: string]: never })[T];
type Overwrite<T, U> = { [P in Diff<keyof T, keyof U>]: T[P] } & U;
type Item1 = { a: string, b: number, c: boolean };
type Item2 = { a: number };
type T3 = Overwrite<Item1, Item2> // { b: number, c: boolean } & { a: number }

The following alternative, adding an extra Pick step, appears to 'fix' that, for whatever it's worth.
type Overwrite<T, U, Int = { [P in Diff<keyof T, keyof U>]: T[P] } & U> = Pick<Int, keyof Int>;

... as far as I know that seems little more than an aesthetic difference. oh well!

I tried using this (the one from @tycho01 and/or @nirendy, not the new one from @ahejlsberg yet) to omit a property from a class that overrides toString(), and it didn't work.  Here's a minimal example:
type Item1 = { a: string, b: number, c: boolean, toString(): string };
type OmittedItem1 = Omit<Item1, "a">
// OmittedItem1 should be { b: number, c: boolean, toString(): string }, but is {}!

I can kind of imagine why overriding toString() and company (uh... valueOf()?  maybe all other prototype methods?) would wreak havoc on anything that enumerates keys, but it seems unfortunate.
Anyone want to speculate whether this is intended behavior of Omit, a bug in Omit, or a bug in Typescript that breaks Omit?

@jcalz:
Yeah, I've had considerable issues with toString (and other Object.prototype method toLocaleString).
For TupleToObject I essentially had to make a list of numberical indices as keys to whitelist as touching toString in no way helped me get it off (though that's different from what you want here).
That said, though it's not going right, I'm not getting {} either -- have you tried this in Playground or a more recent version?
It seems like toString gets eaten with Omit instead of whatever you actually wanted to remove, while Overwrite appears to change toString methods into any (not overwritable)...
I'm gonna need to look into methods, and toString especially, as it seems they aren't playing well with a lot of the operations right now.
type ItemA = { a: string, b: number, c: boolean, toString(): string };
type OmittedItem1 = Omit<ItemA, "a">
// should be { b: number, c: boolean, toString(): string }
// is { a: string; b: number; c: boolean; }
type OmittedItem2 = keyof Omit<ItemA, "a">
// "a" | "b" | "c" | ("toString" & (() => string))
// ^ it actually lied about "toString" being gone; it's just no longer showing because its key is somehow no longer just a string?!

I'm not getting {} though -- which TS version? Playground and newer seem better.

Demonstration

This is amazing! It appears that @nirendy's version doesn't work with optionals:
type Item1 = { a: string, b?: number, c: boolean }
const omitted: Omit<Item1, 'a'> = { c: true }
// Property 'b' is missing in type '{ c: true; }'.

@jcalz: late response but thanks for the repro. seems resolving it may not be trivial though since property access and most operations depending on it are affected; will try further at one point.
@dleavitt:
Thanks for the bug report. I tried a bit; looks like, as you noted, Omit (either version) doesn't currently reproduce the ?. With strictNullChecks it instead appends a  | undefined to the value, which seems not good enough yet to make this type-check. I'm not yet sure of a way to address this that wouldn't require type-level type checks (potentially solved by e.g. #6606) to check whether undefined would satisfy the object properties...

@tycho01 could we solve the ? issue by typing it multi-pass?
i.e.:

make the optional properties non-optional
stash the list of optional properties only, in a generic, aside
do the Omit on the non-optional type
re-add the | undefined to the existent keys of the omitted type

@niieani:

re-add the | undefined to the existent keys of the omitted type

This doesn't actually cut it; with strictNullChecks we already get back { b: number | undefined; c: boolean; }, so the ? appears to matter.
I'll need to admit I don't fully understand what's going on yet. If you use { [P in keyof Item1]: P } the ? appears preserved just fine, meaning the info appears available in keyof Item1, though if you check that itself you don't get to see any additional info. Looks like a magical invisible property, not having checked compiler internals.

2: stash the list of optional properties only, in a generic, aside

Checking whether a property is optional is currently a challenge. Doing a keyof seems not to give this info (in a visible way); number | undefined is clear to us, but the amount of type-level operators is severely limited -- if we know undefined satisfies that type we're good, but on the type level, as it stands, we don't have a way to do that.
// insert `Omit` typing, one or the other depending on whether you use Playground or 2.5

type Item1 = { a: string, b?: number, c: boolean }
type noA = Omit<Item1, 'a'>
// { b: number | undefined; c: boolean; }
// ^ `Omit` degenerates `?` to ` | undefined`
type keys = keyof Item1
// "a" | "b" | "c"
type almost1 = { [P in keyof Item1]: If<ObjectHasKey<noA, P>, (noA & Obj<never>)[P], never> }
// { a: never; b?: number | undefined; c: boolean; }
type almost2 = { [P in keyof Item1]: If<ObjectHasKey<noA, P>, P, never> }
// { a: never; b?: "b"; c: "c"; }

The thing that gets us 'stuck' at that point is that the only way to ditch a: never prop is by plugging almost2's keys into itself, though that would simultaneously make us lose out on b's ? status. In almost1 we're closer to where we wanna go, but no closer to ditching a in a way that'd leave b's ? intact.
While we cannot directly detect or operate on ? itself, operating on it by proxy through checks for | undefined seems a fair enough solution. But yeah, no type-level type checks. Short of upvoting that feature request (or alternatives, I recently saw a comment requesting type-level instanceof + boolean-based type-level conditionals), I dunno.

@niieani: alternatively, say  | undefined should be considered equivalent to ? and file as bug. That could be controversial (I'm not sure if I'd consider it more elegant myself), but it'd be less involved for the TS side so for your purposes potentially better chances of a fix.

@tycho01 yeah, I see it. I think the TypeScript team mentioned somewhere that | undefined should be considered equivalent to ? -- i.e. it aligns with their goals. For most intents and purposes this is how TS currently behaves, although I see what you mean by compiler differentiating somehow.
For example Flow treats these (? and | void) as different things, i.e. you could technically have a property and expect its type to be undefined. However for (all?) practical reasons they are pretty much the same.

@niieani: Yeah. Seems appropriate to file a bug then.

excuse me for being off topic
@jcalz practically speaking toString can be erased from the declaration files, this way it will only appear on the classes/objects that explicitly implement it (provided the default implementation is useless anyway)
this is how it can be done:

set noLib: true in tsconfig.json
get a copy of declaration files you need from https://github.com/Microsoft/TypeScript/tree/master/src/lib and include them to your project
find toString of the Object and comment it out

interface Object {
    /** The initial value of Object.prototype.constructor is the standard built-in Object constructor. */
    constructor: Function;

    /** Returns a string representation of an object. */
    // toString(): string; <--- HERE

@dleavitt @niieani filed it at #16762.

@tycho01 @dleavitt using Pick preserves optionals in both versions of Omit. I'm not sure if this breaks anything else though.
Here's a full example with the concise 2.4 definition.
type Diff<T extends string, U extends string> = ({ [P in T]: P } & { [P in U]: never } & { [x: string]: never })[T];
type Omit<T, K extends keyof T> = Pick<T, Diff<keyof T, K>>;

interface A {
  a: string;
  b?: string;
  c: number;
}

type B = Omit<A, 'c'>;

const a: A = {
  a: '5',
  c: 5,
};

const b: B = {
  a: '5',
};

// Note: typeof B is (correctly) Pick<A, 'a' | 'b'>

Similarly, you can redefine Omit in the legacy version (rest of the definition is omitted).
type Omit<T extends { [s: string]: any }
    , K extends keyof T
    , T1 extends Omit_<T, K>= Omit_<T, K>
    , T1K extends keyof Pick<T1, keyof T> = keyof Pick<T1, keyof T>> = Pick<T, T1[T1K]>;

@Pinpickle: I tried for a bit with the other tests I had. I only see your Omit definition fixing issues, no cons found! 😃

@Pinpickle this is also working "well enough" with the toString() override, or at least workaroundably so. ("Workaroundably" is a word, right?)
type Item1 = { a: string, b: number, c: boolean, toString(): string };
type OmittedItem1 = Omit<Item1, "a">; // { b: number, c: boolean } almost?
type OmittedItem1Fixed = OmittedItem1 & { toString(): string }; // good enough

I was reminded by a comment in #12424, current Omit and Overwrite implementations still fail recreate any string index the source object types might have held. Checking for index presence could be done given #6606.

@ahejlsberg @Pinpickle and others - thanks with the help on this! Using the above technique, we were able to replicate flow's $Diff<A, B> type. This allowed us to correctly handle defaultProps in React:
/**
 * From https://github.com/Microsoft/TypeScript/issues/12215#issuecomment-307871458
 * The Diff type is a subtraction operator for string literal types. It relies on:
 *  - T | never = T
 *  - T & never = never
 *  - An object with a string index signature can be indexed with any string.
 */
export type StringDiff<T extends string, U extends string> = ({[K in T]: K} &
  {[K in U]: never} & {[K: string]: never})[T];

/**
 * From https://github.com/Microsoft/TypeScript/issues/12215#issuecomment-311923766
 * Omits keys in K from object type T
 */
export type ObjectOmit<T extends object, K extends keyof T> = Pick<T, StringDiff<keyof T, K>>;

/**
 * Returns a version of type T where all properties which are also in U are optionalized.
 * Useful for makding props with defaults optional in React components.
 * Compare to flow's $Diff<> type: https://flow.org/en/docs/types/utilities/#toc-diff
 */
export type ObjectDiff<T extends object, U extends object> = ObjectOmit<T, keyof U & keyof T> &
  {[K in (keyof U & keyof T)]?: T[K]};

How do you write Omit to handle both static and instance properties? This is what I have to do currently:
class Hmm {
    readonly I1 = 'I1';
    readonly I2 = 'I2';
    static readonly S1 = 'S1';
    static readonly S2 = 'S2';
};

// "I2"
type WorksForInstancePropsOnly = Omit<Hmm, 'I1'>;

// "prototype" | "S1" | "S2"
type HasAnnoyingPrototypeKey = keyof typeof Hmm;

// "S2"
type WorksForStaticPropsOnly = Omit<typeof Hmm, 'S1' | 'prototype'>;

// "I1" | "S2"
type WorksForBoth = Omit<Hmm & typeof Hmm, 'I1' | 'S1' | 'prototype'>;

type OmitFromBoth = ???

@rob3c:
type OmitFromBoth<T, K extends keyof T> = Omit<T & typeof T, K | 'prototype'>;
type WorksForBoth = OmitFromBoth<Hmm, 'I1' | 'S1'>;
// "I1" | "S2"

Like that? Untested, but you just wanted your last example shortened right?

@tycho01 I tried that already as well as other variations, but none worked. There doesn't seem to be a way to reference T's prototype within the generic definition. That's probably due to javascript not allowing access to 'static' prototype properties from an instance (unlike, say, Java). That's why I deleted the question, but you answered too fast :-)

@rob3c: So no typeof on T huh? I see what you're getting at then; I hadn't really tried things like that so far. I'll admit I'm not aware of workarounds in that case. I'm slowly discovering debugging with the compiler is a bit less bad than I thought, but still not too great.

@robc there actually are ways to access prototype in a generic context (I'm not curious about what the question was 😁).

@aluanhaddad The question was essentially about writing a version of Omit above that returns filtered keyof properties for both instance and static members of a type while only needing to write Omit<MyClass, ...> and not Omit<MyClass & typeof MyClass, ...>. I was saying prototype above, but it should have been constructor, since that's where the 'static' members are stuck by typescript (I think I got distracted by trying to filter out the 'prototype' property in my code and the example). And for various reasons documented elsewhere, the constructor property is only typed as Function, so all variations I tried that pulled keys from the 'constructor' member only resulted in those on Function without the static props declared in the class.
Anyway, although interesting in terms of generic type wrangling, it's irrelevant in my particular case, since you can't directly access static members from an instance anyway in javascript lol (I blame it on momentary language blindness due to insufficient coffee.)
The original code was something like this:
type Diff<T extends string, U extends string> = (
    & { [P in T]: P }
    & { [P in U]: never }
    & { [x: string]: never }
)[T];

type Omit<T, K extends keyof T> = Pick<T, Diff<keyof T, K>>;

class Hmm {
    readonly I1 = 'I1';
    readonly I2 = 'I2';
    static readonly S1 = 'S1';
    static readonly S2 = 'S2';
};

// "I2"
type WorksForInstancePropsOnly = base.Omit<Hmm, 'I1'>;

/// "prototype" | "S1" | "S2"
type HasAnnoyingPrototypeKey = keyof typeof Hmm;

// "S2"
type WorksForStaticPropsOnly = base.Omit<typeof Hmm, 'S1' | 'prototype'>;

// "I1" | "S2"
type WorksForBoth = base.Omit<Hmm & typeof Hmm, 'I1' | 'S1' | 'prototype'>;

type OmitForBoth<T, K extends keyof T> = ???

@rob3c

Anyway, although interesting in terms of generic type wrangling, it's irrelevant in my particular case, since you can't directly access static members from an instance anyway in javascript lol (I blame it on momentary language blindness due to insufficient coffee.)

that statement is inaccurate.
it is possible ofc
class Hmm {
  static s1 = 'static one'
  static s2 = 'static two'
  i1 = 'instance one'
  i2 = 'instance two'
}

const foo = new Hmm()

console.log(foo)

const {s1, s2} = foo.constructor

console.log({s1, s2})

@Hotell

that statement is inaccurate.

Actually, my statement IS accurate, but you may have misunderstood my terminology :-)
Unlike Java, for example, you can't directly access static members on an instance (e.g. myInstance.myStaticProp). Your example shows an attempt at indirect access via the instance's constructor property - which typescript will complain about btw with corresponding red squigglies in vscode, because that's only available at runtime. That's why I lamented constructor being only typed as Function above, instead of something more strongly-typed (see https://github.com/Microsoft/TypeScript/issues/3841 and related).

Anyway, the question pertains to generic type definitions using keyof and such for the purposes of strongly-typed intellisense and overall type-checking while writing code, not what's really available at runtime. Since the intention behind my use of keyof was for strongly-typing the available declared directly-accessible properties, their availability on constructor at runtime is irrelevant (as stated above).
Even with respect to just the theoretical question on whether it's possible to combine both in a generic type definition using only T, the answer is no without explicitly typing constructor on the classes of interest, since it's only typed Function in general.

I'm trying to use Omit type as suggested by @aldendaniels in this comment:
export type RegionsTableProps =
ObjectOmit<TableProps, 'headerHeight' | 'rowHeight' | 'rowCount'> &
{
  regions: Region[];
  onRegionClick: (id: string) => void;
};

class RegionsTable extends React.PureComponent<RegionsTableProps> {}

where TableProps is from @types/react-virtualized (width?: number;)
However, when I try to use RegionsTable like this:
  table = ({ width, height }: Dimensions) => (
    <RegionsTable
      regions={this.props.regions.list}
      onRegionClick={this.onRegionClick}
      width={width}
      height={height}
    />
  );

I get error:
TS2339: Property 'width' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<RegionsTable> & Readonly<{ children?: ReactNode; }...'.

If I replace ObjectOmit<TableProps, 'headerHeight' | 'rowHeight' | 'rowCount'> with Partial<TableProps> everything compiles.
I don't quite understand what is going on and how to fix this. Anyone got any ideas?

@doomsower it's probably due to [key: string]: any in GridCoreProps
// A = never
export type A = StringDiff<keyof TableProps, 'headerHeight' | 'rowHeight' | 'rowCount'>

(ts 2.4.2)

@ahejlsberg Diff, Omit and Overwrite are awesome, can we expect them to make it into the standard library at some point alongside Record, Partial, Readonly, Pick, etc.?

for Overwrite, which version would be considered preferable?

For those interested, I've added Diff, Omit and Overwrite to Type Zoo.

@pelotom there's already https://github.com/gcanti/typelevel-ts and https://github.com/tycho01/typical

@goodmind the more the merrier

Agreed, while we've yet to even settle on all the right best practices we definitely need more competition. Type libs still face significant issues in testing with e.g. non-terminating types (usually bugged recursive types) -- rather than having a single unit test fail your whole compilation just fails to terminate. I'd love to see more people try their own take on things on whatever level.

I've noticed an issue with Omit and generic functions, or at least with one of the implementations. Not quite sure how to describe it, so I'll stick with a code sample:
type Diff<T extends string, U extends string> = ({ [P in T]: P } &
  { [P in U]: never } & { [x: string]: never })[T];
type Omit<T, K extends keyof T> = { [P in Diff<keyof T, K>]: T[P] };

interface BaseType {
  x: string;
}

const fnWithDefault = <T extends BaseType>(
  input: Omit<T, keyof BaseType>
): T => {
  // Error: Spread types may only be created from object types
  const attempt1 = { ...input, x: 'foo' };
  // Error: Type 'Omit<T, "x"> & { x: string; }' is not assignable to type 'T'.
  return Object.assign({}, input, { x: 'foo' });
};

fnWithDefault<{ x: string; y: string }>({ y: 'bar' });

fnWithDefault is a function that adds x to the result, returning T, and thus the input type should be T without x. TypeScript, however, doesn't seem to allow this with either spread or Object.assign.
Basically, I would expect Omit<T, 'x'> & { x: string }  to be assignable to T. (assuming that T.x is a string). Not sure if this is a problem in TypeScript, or with the Omit implementation, or is even by design.

I think the Spread type in #21316 is essentially a superior version of Overwrite here.

Commenting here for folks who got to this issue page from the net after the release of 2.8.
With TS 2.8 the more convenient way of implementing Omit now the below, taking advantage of conditional types and new built-in types:
type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>

Along those lines, here's an implementation of Overwrite:
type Overwrite<T1, T2> = {
    [P in Exclude<keyof T1, keyof T2>]: T1[P]
} & T2;

Is there a way with 2.8 Exclude etc to prevent optional properties being spat out as type | undefined here?
type Overwrite<T1, T2> = { [P in Exclude<keyof T1, keyof T2>]: T1[P] } & T2;
type A = Overwrite<{ myOptional?: string, myRequired: number }, { myRequired: string }>;
let x: A = {
  myRequired: 'hello'
};

@drew-r Can't you just use NonNullable<T[P]>?

@drew-r try this solution: https://github.com/Microsoft/TypeScript/issues/12215#issuecomment-378367303

@drew-r Use this for Overwrite:
type Overwrite<T1, T2> = Pick<T1, Exclude<keyof T1, keyof T2>> & T2

Pick is specially treated by the compiler and will preserve modifiers in the original type, instead of transformin them.

More information can be found in the docs:

Readonly, Partial and Pick are homomorphic whereas Record is not. One clue that Record is not homomorphic is that it doesn’t take an input type to copy properties from:

type ThreeStringProps = Record<'prop1' | 'prop2' | 'prop3', string>

Non-homomorphic types are essentially creating new properties, so they can’t copy property modifiers from anywhere.

type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>

I know this was dropped so far from the TypeScript codebase, but I see myself and colleagues nearly weekly and in every new project. We just use it so much and because it is like the "opposite" of Pick I just feel more and more that this should ship with TypeScript be default. It is especially hard for new TS developers who see Pick and look for Omit and don't now about this GitHub thread.

Is there a way to remove a wide type from a union type without also removing its subtypes?
export interface JSONSchema4 {
  id?: string
  $ref?: string
  // to allow third party extensions
  [k: string]: any
}
type KnownProperties = Exclude<keyof JSONSchema4, string | number>

// I want to end up with
type KnownProperties = 'id' | 'ref'
// I want to end up with
type KnownProperties = never
// yet it seem so very within reach
type Keys = keyof JSONSchema4 // string | number | 'id' | 'ref'

Also on stackoverflow.

Is that somewhat based on the original Diff hack?

I see it's actually a common pattern of using this feature, but I will also leave this here for reference:
type KnownRequiredKeys<T> = {
  [K in keyof T]: string extends K ? never : number extends K ? never : undefined extends T[K] ? never : K
} extends { [_ in keyof T]: infer U } ? U : never

This version only gets the keys where the key isn't optional. Null is fine though:
interface test {
  reqButUndefined: undefined
  req: string | null
  opt?: string
  [k: string]: any
}
type c = KnownRequiredKeys<test> // 'req'

unfortunately, AFAIK it's not currently possible to distinguish between keys that can have the value undefined and those that can be not present in the object's properties.

All credit goes to @ajafff! https://github.com/Microsoft/TypeScript/issues/25987#issuecomment-408339599

@jcalz

{} extends Pick<T, K>

Why, I'd never!

No good deed goes unpunished.

Like @donaldpipowitch indicates above, can we please have Omit in TypeScript as well. The current helper types like Exclude and Pick are super useful. I think Omit is also something that comes in very handy. We can always create it ourselves with

type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>

But having it built-in instead of always having to lookup this type would be super nice! I can always open a new issue to discuss this further.

The Omit helper type has official support as of TypeScript 3.5
https://devblogs.microsoft.com/typescript/announcing-typescript-3-5/#the-omit-helper-type

Can anyone help me try to get keys that I can work with from the following:
type c = RequiredKnownKeys<test> // 'reqButUndefined' | 'req'
type d = OptionalKnownKeys<test> // 'opt'

How do I get something like Object.keys(d) so I can console.log(d) and it will output 'opt'
So essentially im trying to get the keys that are left over on the type so I can work with them further.  I cant use a type as a value so im not sure how I can get the remaining keys out to a workable format

@mattvb91 types don't exist at runtime. There's no difference in JS between an optional and a required field.
If you want "type information" at runtime, you need to define it in JS language values, and then maybe you can make TypeScript typecheck something based on that information if it is declared as const so the string names are literal and not just string.
This is not the place for that kind of question though, you should go to a support place, such as
Discord: https://discord.gg/typescript
Gitter: https://gitter.im/Microsoft/TypeScript

Note that the implementation of KnownKeys in this thread has been broken since TypeScript 4.3.  See #44143 for details and a workaround implementation of
type KnownKeys<T> = keyof { [P in keyof T as
    string extends P ? never : number extends P ? never : P
    ]: T[P]; };


Add Travis build status badge to README.md

Thanks @Dominator008 but we already have this listed over in https://github.com/github/linguist/blob/master/CONTRIBUTING.md


hostname as FQDN

Please let me know, how to convert host tag to fqdn ?
Scenario -- below is my alert string and I wanna replace <HOSTNAME> to <FQDN> .. may be this is something I can hardcode in host tag. Please suggest me, how to change host tag / hard code host tag :
{"Date":"2017-03-03T10:13:46Z","Host":"<HOSTNAME>","Source":"Influx","SourceInstance":"Not Applicable","ObjectName":"disk_tea_status","InstanceName":"D:-<HOSTNAME> is WARNING  Current average Disk Utilization value past 15m  is: 93.7328541838882
exceeds threshold of  90%  with Severity:2 )","CounterName":"mean","SampleValue":"93.7328541838882","KPI":"Not Applicable","ThresholdOperator":"Not Applicable","Average":"Not Applicable"}

I would recommend changing the source of the host tag. What are you using to collect the data? Telegraf? Change whatever system to use FQDN instead of just HOSTNAME from the start.

windows pass hostname only ...

OK, you can use https://docs.influxdata.com/kapacitor/v1.2/nodes/eval_node/#tags to map HOSTNAME to FQDN as a first step in your task.

Thanks @nathanielc


docs: adds section about configuring rules

@wtrocki @craicoverflow @rkpattnaik780 This PR is now ready for review.
I added a new attribute, so 17 files were updated accordingly. However, the main changes are in the following file:
docs/registry/rhoas-cli-getting-started-registry/README.adoc

@rkpattnaik780 Can you please review this PR too? Many thanks :)

Thank you @rkpattnaik780 !
@smccarthy-ie Ready for your peer review now, please and thank you :)

Nice work @bredamc, looks great! Left a comment about defining "artifact rules" as artifact-specific up front.


Fix sync from downstream and add exclude to cli

Add exclude to sync-from-downstream CLI.
Fix syncing from downstream.

Would be awesome to have this tested extensively.

I've been a little bit scared, that we have so many tests, but nothing I've tried really works...

The question of the reverse mapping of files is not so easy. My sollution is not the final one. It will only change existing files...

I just tried this on two packages and it worked okay. Shall we merge?

Please, I wait. I would like to rebase.

I've rebased and created a follow-up issue to make it better (#354). We can merge this now.


[Question] How to add second Verb to Verb

Hi,
I have a question about Verb.
Is there an option to add the second Verb to the existing Verb? e.g.
I have a menu when the application is started with the parameter --help
test_app.exe --help
test_app 1.0.0
Copyright (C) 2020 docker_status

  all         Check all containers on a remote Linux machine.

  status      Check containers status on a remote Linux machine.

  ports       Check containers ports on a remote Linux machine.

  versions    Check containers version on remote Linux machine based on docker
              image.

  logs        Check container log on a remote Linux machine.

  config      Set connection configuration.

  help        Display more information on a specific command.

  version     Display version information.

When I select config  I also want something like above e.g. (second Verb?)
test_app.exe config --help
test_app 1.0.0
Copyright (C) 2020 test_app

  add    Add new configuration.

  update    Update existing configuration.

  remove      Remove the existing configuration.

  show    Show configuration.

and when selected add the proper options will appears e.g
test_app.exe config add --help
  -i, --ip          Required. Enter IP for a remote Linux machine.

  -u, --username    Required. Enter the username for a remote Linux machine.

  -p, --password    Required. Enter the password for a remote Linux machine.

Adding a second Verb to Verb is not supported.


array_search

Sometimes you just need the index of an array and don't want to mess with array_find_index() that needs a lambda.
/// @function				array_search(array, value)
/// @description			Search the array for the value and return it's index or -1 if not found
/// @param {Array}			arr     The array to Search
/// @param {Any}			wValue  The value to look for
/// @return {Real}
function array_search(arr, wValue){
	var len = array_length(arr);
	for (var i=0; i<len; ++i) {
	    if(arr[i] == wValue){
			return i;
		}
	}

	return -1;
}

Seems to be already covered by built-in array_get_index (possibly not in LTS).
Other than that, I agree that lambda is quite an overkill, and it seems YYG devs agreed. ^^
(although there was some prodding from the community involved too ;) )

If it already exists on main then let's close it, shall we?


Improve mirror-files.yml

This pull request does two things

First is extract sync-repo-branch.yml and isolate code into independent scripts instead of them in yaml.

Second is using the PAT directly instead of passing it around via a github parameter.

Change description and usage

Git-Repo-Sync.ps1 extracted from sync-repo-branch.yml and referenced in a file sync-repos.yml.

We use sync-repo.yml in the same way we used mirror-files.yml.

Others

About force pushing, when we meet conflict, how we should do next. Throw error then we resolved it handlly ? Create pull request instead of push directlly ? Or other better ways to resolve this scenario. Let me know if there is any better way or case, thanks ~

For sync-repo.yml, its parameter are used in my local test. If this pull request is passed. Edit mirror-files used template and use it as usual.

/azp automation - mirror-repos

@raych1 if the automation - mirror-repos pipeline successes you can go ahead and merge this.

Pipeline fails currently. @JackTn is investigating.

I submitted another change which should get us past that error.

/azp run automation - mirror-repos

@weshaggard  I push to fix a bug and can you run run automation again ~ It seems i have no permission to do this ~ Thanks!

/azp run automation - mirror-repos

Pipeline run passed with https://dev.azure.com/azure-sdk/internal/_build/results?buildId=2664857&view=results


update SnippetFile.

Sorry again.
When using SnippetFiles when updating, the values Action and PreviousPath were required, so I added them.

I fixed it. please check 🙏 .
https://github.com/xanzy/go-gitlab/pull/1650#discussion_r1102998538

Thanks @blacknon 👍🏻


the method of router.back() won't working on  of iphone6s

Version
3.0.1
Reproduction link
https://jsfiddle.net/cysean/xgrjzsup/4211/
Steps to reproduce
1、click link "Go to Foo"
2、click link "Go to Bar"
3、click link "bar back to prev."
What is expected?
we can write $router.back() in a callback of click event of   on any platform.
What is actually happening?
The method of $router.back() is not execute.

Can you try with @click.prevent? I don't have an iPhone 6 to test it

I have changed the href attribute to href='javascript:;', then it works well.

when I append prevent modifier after click, like<EMAIL_ADDRESS>, the router.back() works. thanks Posva.

Ok, closing then, it looks like something specific to iPhone 6 browser


optimize for shim

Signed-off-by: yuexiao-wang<EMAIL_ADDRESS>
Declare a var ctx  in place of gocontext.Background() in shimCreateCommand.
Use var group.

Codecov Report

Merging #803 into master will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master     #803   +/-   ##
=======================================
  Coverage   59.26%   59.26%
=======================================
  Files           5        5
  Lines         739      739
=======================================
  Hits          438      438
  Misses        198      198
  Partials      103      103

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0fe0d8f...7fabea3. Read the comment docs.

LGTM

@crosbymichael @AkihiroSuda PTAL
Sorry to respond this PR lately., and change service, err = back.

LGTM


Backup Confirmed message

When Backup by both Phrase + Backup with Keeper ''Recovery Phrase confirmed. Your wallet is backed-up with Bitcoin Keeper."

Completed


[go_router] configuration.matches.last when matches.length == 0

The same code is ok on 5.2.1 ,but it failed on 5.2.2.
It shows some things error
/// for use by the Router architecture as part of the RouteInformationParser
@override
RouteInformation restoreRouteInformation(RouteMatchList configuration) {
if (configuration.matches.last is ImperativeRouteMatch) {
configuration =
(configuration.matches.last as ImperativeRouteMatch).matches;
}
return RouteInformation(
location: configuration.uri.toString(),
state: configuration.extra,
);
}

Hello @changweihua. Thank you for filing this issue. Can you please provide the following information?

A complete and minimal, reproducible example. Ideally, a single main.dart file that can be run directly.
The output of flutter doctor -v
The output of flutter run -v

Please provide the information in the form of text. See how to make collapsible sections with Markdown here.

I'm sorry to reply so late, but I haven't read the news these two days. I have tried the lastest version 5.2.4, it works fine.

Okay thank you for the clarification. Closing this issue it's working as expected


bypassing workers not working (master branch)

bypassing workers is not working as mentioned in the readme docs : https://github.com/GoogleCloudPlatform/psq#bypassing-workers-for-testing
I am getting this error:
20:14:14 worker.1 | Traceback (most recent call last):
20:14:14 worker.1 |   File "/Users/kushgoyal/.virtualenvs/myproject/bin/psqworker", line 11, in <module>
20:14:14 worker.1 |     load_entry_point('psq==0.5.0', 'console_scripts', 'psqworker')()
20:14:14 worker.1 |   File "/Users/kushgoyal/.virtualenvs/myproject/lib/python3.6/site-packages/click/core.py", line 664, in __call__
20:14:14 worker.1 |     return self.main(*args, **kwargs)
20:14:14 worker.1 |   File "/Users/kushgoyal/.virtualenvs/myproject/lib/python3.6/site-packages/click/core.py", line 644, in main
20:14:14 worker.1 |     rv = self.invoke(ctx)
20:14:14 worker.1 |   File "/Users/kushgoyal/.virtualenvs/myproject/lib/python3.6/site-packages/click/core.py", line 837, in invoke
20:14:14 worker.1 |     return ctx.invoke(self.callback, **ctx.params)
20:14:14 worker.1 |   File "/Users/kushgoyal/.virtualenvs/myproject/lib/python3.6/site-packages/click/core.py", line 464, in invoke
20:14:14 worker.1 |     return callback(*args, **kwargs)
20:14:14 worker.1 |   File "/Users/kushgoyal/.virtualenvs/myproject/lib/python3.6/site-packages/psq/psqworker.py", line 116, in main
20:14:14 worker.1 |     worker.listen()
20:14:14 worker.1 |   File "/Users/kushgoyal/.virtualenvs/myproject/lib/python3.6/site-packages/psq/worker.py", line 94, in listen
20:14:14 worker.1 |     super(MultiprocessWorker, self).listen()
20:14:14 worker.1 |   File "/Users/kushgoyal/.virtualenvs/myproject/lib/python3.6/site-packages/psq/worker.py", line 53, in listen
20:14:14 worker.1 |     tasks = self._safe_dequeue()
20:14:14 worker.1 |   File "/Users/kushgoyal/.virtualenvs/myproject/lib/python3.6/site-packages/psq/worker.py", line 46, in _safe_dequeue
20:14:14 worker.1 |     return inner()
20:14:14 worker.1 |   File "/Users/kushgoyal/.virtualenvs/myproject/lib/python3.6/site-packages/retrying.py", line 49, in wrapped_f
20:14:14 worker.1 |     return Retrying(*dargs, **dkw).call(f, *args, **kw)
20:14:14 worker.1 |   File "/Users/kushgoyal/.virtualenvs/myproject/lib/python3.6/site-packages/retrying.py", line 212, in call
20:14:14 worker.1 |     raise attempt.get()
20:14:14 worker.1 |   File "/Users/kushgoyal/.virtualenvs/myproject/lib/python3.6/site-packages/retrying.py", line 247, in get
20:14:14 worker.1 |     six.reraise(self.value[0], self.value[1], self.value[2])
20:14:14 worker.1 |   File "/Users/kushgoyal/.virtualenvs/myproject/lib/python3.6/site-packages/six.py", line 686, in reraise
20:14:14 worker.1 |     raise value
20:14:14 worker.1 |   File "/Users/kushgoyal/.virtualenvs/myproject/lib/python3.6/site-packages/retrying.py", line 200, in call
20:14:14 worker.1 |     attempt = Attempt(fn(*args, **kwargs), attempt_number, False)
20:14:14 worker.1 |   File "/Users/kushgoyal/.virtualenvs/myproject/lib/python3.6/site-packages/psq/worker.py", line 45, in inner
20:14:14 worker.1 |     return self.queue.dequeue(max=self.tasks_per_poll, block=True)
20:14:14 worker.1 |   File "/Users/kushgoyal/.virtualenvs/myproject/lib/python3.6/site-packages/psq/queue.py", line 114, in dequeue
20:14:14 worker.1 |     self.subscription = self._get_or_create_subscription()
20:14:14 worker.1 |   File "/Users/kushgoyal/.virtualenvs/myproject/lib/python3.6/site-packages/psq/queue.py", line 73, in _get_or_create_subscription
20:14:14 worker.1 |     subscription_name, topic=self.topic)
20:14:14 worker.1 | AttributeError: 'Queue' object has no attribute 'topic'

Can I see your queue declaration?

I am using it exactly like mentioned:
q = psq.Queue(None, async=False)
r = q.enqueue(adder, 10, 15)

Sorry for the late response on this, but we've been working hard to improve the underlying pubsub library. Hopefully this issue is resolved with #34. But, if it's not, feel free to comment.


Add Python 3.12 wheels

v3.12 is released and the default in e.g. Conda, so it would be nice to have wheels for it.

Added this to the build workflows in #25.

Wheels are online


Infrastructure: bump velero version and add selector

Description
This PR bumps the version of velero, and introduces a label selector to filter out the resources originated from CrownLabs instances, in order to prevent the partial failures due to the kubevirt/velero issue.
Fixes # (issue)
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Please also note any relevant details for your test configuration.

[x] Deploying the updated manifest in the cluster, and checking that the backup completed correctly

/merge


ispell: 3.3.02 -> 3.4.00

Motivation for this change
Things done

[x] Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
Built on platform(s)

[x] NixOS
[ ] macOS
[ ] other Linux distributions

[ ] Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
[ ] Tested compilation of all pkgs that depend on this change using nix-shell -p nix-review --run "nix-review wip"
[ ] Tested execution of all binary files (usually in ./result/bin/)
[ ] Determined the impact on package closure size (by running nix path-info -S before and after)
[ ] Ensured that relevant documentation is up to date
[x] Fits CONTRIBUTING.md.

This pull request has been mentioned on Nix community. There might be relevant details there:
https://discourse.nixos.org/t/prs-already-reviewed/2617/52

@tadeokondrak are you able to address the issue of the license?

Thanks @tadeokondrak! :tada:

This change did not update the source hash, which causes most use cases to continue using the previous source fetched by hash from the hashed-mirror cache:
$ nix-shell -p ispell
$ which ispell
/nix/store/...-ispell-3.4.00/bin/ispell
                      ^^^^^^
$ ispell -v
@(#) International Ispell Version 3.3.02 12 Jun 2005
                                  ^^^^^^

@chkno do you have a fix you could PR?

When I tried mechanically updating the hash to get the new source, I got this build failure:
$ nix-build . -A ispell
these derivations will be built:
  /nix/store/mhnm84fz6jyzhlfv9q30pdcawfkscplj-ispell-3.4.00.drv
building '/nix/store/mhnm84fz6jyzhlfv9q30pdcawfkscplj-ispell-3.4.00.drv'...
unpacking sources
unpacking source archive /nix/store/j1diff7c4cd8ngiigyj7xilyj2w6fbny-ispell-3.4.00.tar.gz
source root is ispell-3.4.00
setting SOURCE_DATE_EPOCH to timestamp<PHONE_NUMBER> of file ispell-3.4.00/CHANGESpatching sources
applying patch /nix/store/8awvy1yp8mgc7skd6qxp25lppizanzqn-0007-Use-termios.patch
patching file term.c
Hunk #1 FAILED at 87.
Hunk #2 FAILED at 166.
Hunk #3 succeeded at 198 (offset 8 lines).
Hunk #4 succeeded at 308 (offset 28 lines).
Hunk #5 succeeded at 321 (offset 28 lines).
Hunk #6 succeeded at 338 (offset 28 lines).Hunk #7 FAILED at 389.Hunk #8 FAILED at 410.
Hunk #9 FAILED at 429.
Hunk #10 FAILED at 497.
Hunk #11 FAILED at 543.
Hunk #12 FAILED at 579.
Hunk #13 FAILED at 627.
9 out of 13 hunks FAILED -- saving rejects to file term.c.rej
builder for '/nix/store/mhnm84fz6jyzhlfv9q30pdcawfkscplj-ispell-3.4.00.drv' failed with exit code 1
error: build of '/nix/store/mhnm84fz6jyzhlfv9q30pdcawfkscplj-ispell-3.4.00.drv' failed


Search results: different background colors

Steps to reproduce the behavior

Search something (eg: Twix)
Press any icon (back button, filter or My personalized ranking)

Expected behavior
All three buttons should have the same "splash" background color.

Hi,
I would like to work on this.


SSL_read fails with SSL_ERROR_SSL for non-blocking socket

I wrote a server that is using OpenSSL 3.0.7 (built myself on Windows) and 3.0.2 on Ubuntu 22.04 (system-provided).
When I added error handling, I ran into a bug that I cannot explain. It happens on both OS's.
For the first connection, it works (sometimes), but every client that connects after the first connection is closed will trigger SSL_ERROR_SSL when the socket has no data to read.
I do something like this (irrelevant error handling removed for better readability since there are no errors in those parts):
SOCKET ClientSocket = accept(Socket, NULL, NULL);
setsockopt(ClientSocket, IPPROTO_TCP, TCP_NODELAY, &value, sizeof(value));
SetSocketBlocking(ClientSocket, false); //set non-blocking
char value = 1;
setsockopt(ClientSocket, IPPROTO_TCP, TCP_NODELAY, &value, sizeof(value));
SSL* ssl = SSL_new(ctx);

This is being executed on a different thread right after:
SSL_set_fd(ssl, (int)ClientSocket);
while(SSL_accept(ssl) != 1);

On another different thread (looped) after previous operations are completed, called approximately every 1 second or earlier when data is available to read (using poll):
data_length = SSL_read(ssl, (char*)buffer, PendingBytes);
if (data_length <= 0) {
  HandleSSLError(SSL_get_error(ssl, data_length));
  return false;
}

I also use SSL_write somewhere but the error happens before I call it.
This is the HandleSSLError function with my workaround. This should not work because SSL_ERROR_SSL is non-recoverable. But it does work without any issues whatsoever.
inline void HandleSSLError(const int SSLError){
  if(SSLError != SSL_ERROR_WANT_READ && SSLError != SSL_ERROR_WANT_WRITE && SSLError != SSL_ERROR_NONE){
    if (SSLError == SSL_ERROR_ZERO_RETURN) {
      ConnectionError = EConnectionError::ClosedRead;
    }
    else {
      if (SSLError == SSL_ERROR_SSL) { //workaround
        const auto Error = WSAGetLastError();
        if (Error == WSAEWOULDBLOCK) {
          std::array<char, 1024> Buffer = { 0 };
          ERR_error_string_n(ERR_get_error(), Buffer.data(), Buffer.size());
          std::cout << Buffer.data() << std::endl;
          return;
        }
      }
      ConnectionError = EConnectionError::ForceClose;
    }
  }
}

I feel like the error should be SSL_ERROR_WANT_READ or SSL_ERROR_WANT_WRITE.
The error message is: error:0A000126:SSL routines::unexpected eof while reading
Edit: I "fixed" it using SSL_CTX_set_options(ctx, SSL_OP_IGNORE_UNEXPECTED_EOF); but that leaves me vulnerable to truncation attacks. Well, they would not work for other reasons, but I would still not consider this a fix.
Edit 2: I've now gone through the relevant OpenSSL source code. If I understand it correctly, it uses a socket BIO, which correctly handles the WSA error code and must get the same as my code (WSAEWOULDBLOCK). But for some reason, it doesn't seem to set the flags for retry in the BIO, which causes an unexpected EOF error. But that is impossible unless for some reason it tries to read zero bytes. However, I do not attempt to read zero bytes (actually 1 byte), so it must be an internal error.

The error message is: error:0A000126:SSL routines::unexpected eof while reading

This means that the client abruptly terminated the connection without closing down gracefully. You should look into why the client is doing so - but in any case your server will need to be able to handle impolite clients like this. It is actually quite common for clients to close like this if they don't like the connection for some reason.
It might be worth capturing a pcap trace of the communication. Sometimes this reveals the cause of such failures.

SSL_set_fd(ssl, (int)ClientSocket);
while(SSL_accept(ssl) != 1);

As an aside you probably also be calling SSL_get_error() here too and handle responses accordingly - an SSL_ERROR_SSL could occur at this point if the handshake fails and you could end up in an infinite loop.

This means that the client abruptly terminated the connection without closing down gracefully.

I am certain that it does not do that when the error occurs. Otherwise I could not ignore the error and continue as if nothing happened.

As an aside you probably also be calling SSL_get_error() here too

I removed the error handling for this post for better readability because it was irrelevant, that part of the code does not fail in this case. The TLS handshake is performed and a single packet arrives at the server. Subsequent calls to SSL_read when there is no data available yet will trigger this error.
I do not understand how this could happen and why not on the very first connection. I restarted the client application, so it can't be that.
I just realized that I don't clear the error queue, so it could be an old error, actually. But that would not explain why I get SSL_ERROR_SSL.

I just realized that I don't clear the error queue, so it could be an old error, actually. But that would not explain why I get SSL_ERROR_SSL

SSL_get_error() does this:
    if ((l = ERR_peek_error()) != 0) {
        if (ERR_GET_LIB(l) == ERR_LIB_SYS)
            return SSL_ERROR_SYSCALL;
        else
            return SSL_ERROR_SSL;
    }

So, any stale error on the error queue results in SSL_ERROR_SSL (unless it happens to be a SYS error).
Plausibly you've got a previous connection finishing with an unexpected EOF, and that error is remaining on the error queue affecting the next connection.

Plausibly you've got a previous connection finishing with an unexpected EOF, and that error is remaining on the error queue affecting the next connection.

Oh my god, I missed that entirely, somehow. It even states in the documentation that the error queue must be empty.
Well, it is not the most intuitive library, you really need to take your time to read the documentation and I don't have much of that.
I think that should solve the issue. Thank you so much.


fix(deps): update dependency graphql to v14.7.0

This PR contains the following updates:

Package
Type
Update
Change

graphql
dependencies
minor
14.6.0 -> 14.7.0

Release Notes

graphql/graphql-js
v14.7.0
Compare Source
v14.7.0 (2020-07-06)
New Feature 🚀

Backport #2688 Added new 'FormattedExecutionResult' type (@IvanGoncharov)

Committers: 1

Ivan Goncharov(@IvanGoncharov)

Renovate configuration
:date: Schedule: At any time (no schedule defined).
:vertical_traffic_light: Automerge: Disabled by config. Please merge this manually once you are satisfied.
:recycle: Rebasing: Whenever PR becomes conflicted, or if you modify the PR title to begin with "rebase!".
:no_bell: Ignore: Close this PR and you won't be reminded about this update again.

[ ] If you want to rebase/retry this PR, check this box

Available now for Enterprise: Renovate Pro with real-time webhook handling and priority job queue.

Renovate Ignore Notification
As this PR has been closed unmerged, Renovate will now ignore this update (14.7.0). You will still receive a PR once a newer version is released, so if you wish to permanently ignore this dependency, please add it to the ignoreDeps array of your renovate config.
If this PR was closed by mistake or you changed your mind, you can simply rename this PR and you will soon get a fresh replacement PR opened.


layer.conf: make 'read-only' overrideable

Commit bcc76fbc587c [Essential:make essential as read-only by default]
used '=' instead of '?=' making this non-overwriteable. Use the
correct operator in order to allow folks to overwrite this in their
local.conf or elsewhere.
Signed-off-by: Mark Asselstine<EMAIL_ADDRESS>

Not true: I override this every single build:
LAYERVERSION_yoctobsp="3"

$OVERC_ESSENTIAL_MODE [2 operations]
set /home/bruce/overc-project/project/layers/meta-overc/meta-cube/conf/layer.conf:66
"read-only"
set /home/bruce/overc-project/project/build/conf/local.conf:313
"read-write"
pre-expansion value:
"read-write"
OVERC_ESSENTIAL_MODE="read-write"

meta-cube/conf/layer.conf:OVERC_ESSENTIAL_MODE = "read-only"

I was scratching my head on this as well since the original commit was quite old. Maybe I had a typo, I will have to look again.


JSON - Unable to load schema <schema_name>. No schema request service available.

I'm getting this error when trying to load a JSON schema. There is no additional information in the console.   My app is hardly more complex than the boilerplate setup.  Its just an index.html file and /node_modules/monaco-editor.  I'm serving it via a simple web server.  Below is the index.html
Happy to help debug this further if someone can point me in the right direction.
<!DOCTYPE html>

    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8" >

monaco-editor npm version: 0.8.1
Browser: Chrome
OS: Windows 10

I'm having the same issue. Would be lovely to make schema validation possible.

@aapoalas - I was able to hack my way around this by fetching the JSON on my own and then providing the POJO in the config.  See below.
fetch('./mySchema.json')
        .then(res =>res.json())
        .then((schema) => {
            var config = {
                schemas: [{
                    fileMatch: ['*.json'],
                    schema
                }],
                validate: true,
                allowComments: true
            }
            require(['vs/editor/editor.main'], function() {
                monaco.languages.json.jsonDefaults.setDiagnosticsOptions(config);
  .......

I was able to make it working by editing the minimized jsonWorker.js where I added the following:
this._languageService=i.getLanguageService({promiseConstructor:a,

schemaRequestService: (url) => {
    return fetch(url).then(resp => resp.text())
},
resolveRelativePath: (relativePath, resource) => {
    return relativePath
}

})

@aeschli is the problem with Monaco that the schemaRequestService interface @czb called out isn't exposed in the public API?

@michael-hawker Yes, the schemaRequestService currently only exists on the json worker. What's missing is that we have the API also on the main thread and the code that forwards the requests from the worker to the Main thread.

I'm running into this issue.  I have a web application that relies on a set of JSON schema files for code completion and validation.  When using the Monaco-editor, it seems like I can actually get the code completion to work using a relative path to the json schema files.  But the second I turn on validation, it fails.
If I instead reference the file via http address, it loads it but fails due to relative "$ref" paths in the schema.  If I remove those or update them to point to the http address, validation and code completion work.
@aeschli - Is there a reason relative file paths work for code completion but not validation?  Can you point me in the direction of where I could fix that locally?  Short term, my fix may be to write a script to replace all of the refs with the http addresses.

@RVEIII That sounds strange, I'm nor aware of any difference regarding resolving references for code completion or for validation.
To investigate you would have to give more more information. How did you configure the Monaco editor, how does the schema look like. Can you provide a HTML test page like above?

Hey @aeschli, I got the schema working.  I loaded the schema files into memory and referenced them that way.  Then I spun through them and changed all of the relative $ref properties to point to absolute paths that matched the URIs I set in the json diagnostic options.

I too would like to set schemaRequestService.
I load json schemas on-demand from an application bundle, rather than from fetch(), so I need a way to override schemaRequestService.
(Also, contextService.resolveRelativePath seems to be missing)
monaco 0.20.0

Closing due to inactivity.
If this bug still applies, please create a new issue. Make sure to select the form for bugs and include a minimal reproducible example. Thanks!


[Feature Request] Vaccum Chest Comparator support

If it can be done without too much effort, it'd be a nice improvement.

Thank you for your suggestion. It has been added to our list or possible enhancement.
This ticket will be closed because we want the list of open tickets to reflect known issues.


Refactor TestWriteUpgradeCancelChannel to use table tests

Refactor TestWriteUpgradeCancelChannel to use table-driven tests.
Originally posted by @damiannolan in https://github.com/cosmos/ibc-go/pull/4404#discussion_r1300134533

That'd be awesome, I was thinking we could use this kind of test structure:
testCases := []struct{
    name string
    malleate func()
    expError error
}{
        {
             "success",
             func() {},
             nil,
        },
        // failure scenarios with expected error
}

We can take the existing test setup and move it to the test body and make some assertions based on the inputs of WriteUpgradeCancelChannel mutated by malleate().
I'll assign @ThanhNhann, feel free to make a PR and reach out if you've any questions

I think @ThanhNhann might need to drop a comment here, assigning has some restrictions apparently https://docs.github.com/en/issues/tracking-your-work-with-issues/assigning-issues-and-pull-requests-to-other-github-users#about-issue-and-pull-request-assignees

I think @ThanhNhann might need to drop a comment here, assigning has some restrictions apparently https://docs.github.com/en/issues/tracking-your-work-with-issues/assigning-issues-and-pull-requests-to-other-github-users#about-issue-and-pull-request-assignees

Yes, correct. @ThanhNhann needs to comment here first. :)

Hi all, I'm here now 😄


ClickEventError when no mini skittles added

there is a crash when the main skittle is clicked when there are no mini skittles added

fixed in 088d33f83cf8aedee7ee01e48d98eadfb8bfdf4f


Flow Modern flattens Arrays in output

The code generation for a standard Relay connection is generated like the following. Notice that the edges field is not generated as an array, but instead a single object type:

  edges: ?GetFoosById_foos_edges,      // A list of edges.

Schema:
type Foo {
  id: ID!
  description: String
}

# A connection to a list of items.
type FooConnection {
  # Information to aid in pagination.
  pageInfo: PageInfo!

  # A list of edges.
  edges: [FooEdge]
}

# An edge in a connection.
type FooEdge {
  # The item at the end of the edge
  node: Foo

  # A cursor for use in pagination
  cursor: String!
}

Generated:
export type GetFoosById_foos_pageInfo = {|
  __typename: "PageInfo",
  hasNextPage: boolean,     // When paginating forwards, are there more items?
  hasPreviousPage: boolean, // When paginating backwards, are there more items?
  startCursor: ?string,     // When paginating backwards, the cursor to continue.
  endCursor: ?string,       // When paginating forwards, the cursor to continue.
|};

export type GetFoosById_foos_edges_node = {|
  __typename: "Foo",
  id: string, // The ID of an object
  description: ?string,
|};

export type GetFoosById_foos_edges = {|
  __typename: "FooEdge",
  cursor: string,                     // A cursor for use in pagination
  node: ?GetFoosById_foos_edges_node, // The item at the end of the edge
|};

export type GetFoosById_foos = {|
  __typename: "FooConnection",
  pageInfo: GetFoosById_foos_pageInfo, // Information to aid in pagination.
  edges: ?GetFoosById_foos_edges,      // A list of edges.
|};

export type GetFoosById = {|
  foos: ?GetFoosById_foos
|};

I think the same is true for ts-modern/typescript-modern.


package.json: suggestion to rename (+combine) problem matchers

I suggest to move the identical opencobol + gnucobol problem matchers to a single group "gnucobol-legacy" and rename "gnucobol3" (which also works fine for GnuCOBOL 4) to "gnucobol".

Hard to justify breaking peoples builds, even though it does feel like a reasonable thing todo.

I know, but it is easier to break now (with maybe 500 users), of course with an entry in the user-visible ChangeLog (which is also rendered in the extension view)than in two or twelve months as users currently increase (and OpenCOBOL and GnuCOBOL legacy will likely vanish someday, too, leaving only "gnucobol3" which is then possibly at version 5...)
Therefore I suggest to break my and other builds with a clear description now, instead of keeping those old entries duplicated forever. Note: it will also "fix" some builds, I've seen more than one user with "gnucobol-cobc" (as this is what your README has) that actually use GnuCOBOL 3...

From my perspective, the open-source COBOL community is all over the place.
Just doing a quick look at the distro, most BSD variants are still including open-cobol, standard/LTS/stable Linux distros are using gnu-cobol 2.2 and the bleeding distro edge have gnu-cobol 3.0rc1.
On top of this, the alternative open-cobol break away in japan is popular, as it has been enhanced to include better multi-byte character support and defaults to the vbiasm with oesql support.
My conclusion is that I will keep it in mind and review it either when GnuCOBOL 4 comes out or if something changes, then I will take a look at it... however I suspect when I have completed a feature I am looking into it will make the use of manual tasks a thing of the past.

OK. I could PR a README change to the task definition sample to include the hint on GnuCOBOL 3 and the additional ProblemMatcher to cope for internationalization - or would you prefer doing that on your own?


Audio actions in routines are not supported by this device -RPi

Hi
I use Alexa on my Raspberry Pi.
Everything works fine so far until I create a routine and want that alexa is saying something.
as soon as I do that alexa says:
Audio actions in routines are not supported by this device
but than she says my text.
I changed the setup in the Alexa Voice Service (Developer) Site
-> Product
-> Capabilities
tack: Connected Speaker Technology
but I did this after my initial Alexa Installation
But this didn´t solve my issue
Do I have to do anything else? Does the change need some time?
Thanks
BR René
Tell us what hardware you're using:

[ ] Desktop / Laptop
[x] Raspberry Pi
[ ] Other - tell us more:

Tell us about your OS (Type & version):

[x] Linux
[ ] MacOS
[ ] Raspbian Stretch
[ ] Raspbian Jessy
[ ] Other - tell us more:

Hi @Zacki84,
Can you attach DEBUG9 logs of the interaction (https://github.com/alexa/avs-device-sdk/wiki/Build-Options#build-types)? Also, which version of the SDK are you using?

I am closing this issue due to inactivity. Please feel free to re-open it if it has been closed in error.


possible problem while merging model

when using merge model function in merge tab,if i simply typed name without .pth it will try to generate a file without pth extension

https://github.com/ddPn08/rvc-webui/commit/836d6ad602a201a4f8e2ca078bf156c32569f4e3
Fixed in this commit.


call to "Query::class" methods directly

new ability added to database for call query methods directly. for this __call added in to "database.php" :
for ex:
$database->query()->where('name','foo')->result();  //working
also
$database->where('name','foo')->result();  //working
and some other refactors
;)

I like it! Simplifies querying. I'll push this in the next update. Thanks!

@faryar76 This has been merged and I'm planning to set a new version release up in a few, since its backward compatible, we'll just make this a minor version 1.0.22. I have also updated the readme to reflect the new query access (since its a lot cleaner this way)


Only load yaml files

This pull request is a small one, so I followed the instructions in CONTRIBUTING.md and just created it directly.
I currently use vim to edit the routes yaml files, and the binary swap files it generates are included in the set of files to validate. That would, of course, fail: a binary file is no yaml. This PR makes it so only files with a .yaml or .yml extension (case-sensitive) are parsed and ran.
I also added the swap files to .gitignore, and fixed a typo in the contribution guidelines.

Thanks for your contribution!


DISABLE_EXTENSIONS=1 still uses ActiveAppsLoader - CompilerPass not used and produces exception if used.

PHP Version
8.1
Shopware Version
<IP_ADDRESS>
Expected behaviour
If DISABLE_EXTENSIONS=1 either ensure that the ActiveAppsLoader does not return any apps or make sure the corresponding DisableExtensionsCompilerPass is used.
It can be fixed by either

just checking for DISABLE_EXTENSIONS in the activeappsloader or better by decorating the acitve apps loader and checking for DISABLE_EXTENSIONS=1 there and return empty array if false and only otherwise return true.
Ensure the compiler pass is used correctly: in the Framework class:

Adding it in the framework class like: $container->addCompilerPass(new DisableExtensionsCompilerPass());
Correct the code for the compiler pass:

public function process(ContainerBuilder $container): void
{
    if (!EnvironmentHelper::getVariable('DISABLE_EXTENSIONS', false)) {
        return;
    }

    $container->getDefinition(ActiveAppsLoader::class)->setClass(EmptyActiveAppsLoader::class);
}

Actual behaviour

DisableExtensionsCompilerPass is not added as compiler pass which means the ActiveAppsLoader is still used.
the compiler pass does not change the service definition but the service completely which most likely will fail with  You have requested a non-existent service "Shopware\Core\Framework\App\ActiveAppsLoader".. At least it did for me.
`

How to reproduce
Use DISABLE_EXTENSIONS=1 bin/console deb:cont ActiveAppsLoader. To be safe do a rm -rf var/cache first.

Thanks for the detailed bug report. We will fix this.


[feature] blacklist for file explorer tab

In VS Code there's a way to blacklist certain directories/files i.e .git, target, etc from showing up in the file explorer tab and it would be very helpful if that was added to lapce
Either as a global config or as a workspace specific on
If it was per-workspace, I think being able to automatically generate the blacklist from a .gitignore file would also be nice (but not necessary)

Having a "VCS Ignore" option to block things in your .gitignore would be amazing. Working with python and having to scroll past all of the __pycache__ folders can be annoying at times.

It looks like there is no relevant info for a long time.
Is anyone working on it?
I'm interested about this feature, I'll try to implement or collaborate.

Would be nice (and would make sense) if this were to apply to the file-select palette as well.

Any updates concerning this?

Any updates concerning this?

Someone will comment if there will be any

I looked into this briefly, and I think we could use the ignore crate and from my vague understanding looking through the codebase I think we want to modify something around FileExplorerData::node_tree.

The issue has been resolved. If you want more functionality, please open another issue.

The issue has been resolved. If you want more functionality, please open another issue.

@panekj
As it tends to happen with these things, immeditely after posting I found the context I was missing. looks like there was already a PR to solve the .gitignore issue. nevermind. thanks!


[Working log] Attempting to build a web app that uses graph-*

For Dimitri. This is a working log of all the issues I hit trying to get things working in the browser.
Goal 1: Build a web app that uses palm-lite
Goal 2: Build a web app that creates a breadboard programatically and runs it (using Starter Kit)
Goal 3: Build a web app that loads a graph and shows the mermaid view
Goal 4: Build a web app that loads a graph and runs it.
Goal 5: TBD
Environment: Preact, Typescript, Vite.
Goal 1
Palm-lite is confirmed to work in the browser. It hasn't got dependencies that are not Node or Browser compatible.

[x] Palm-lite

[x] Text Completion
[x] Chat
[x] Embedding

Goal 2 - Build a web app that creates a breadboard programatically and runs it (using Starter Kit)
The simplest demo that does something useful should call the Palm API. The demo should request the API key,

[ ] Create a breadboard

[x] Add the Starter Kit
[ ] Use API_Key Secrets: FAIL - the code in secrets.ts uses process which is not available to the browser     .map((key) => [key, process.env[key]]). You can make an global though.

window.process = {};
window.process.env = {};
window.process.env.API_KEY = apiKey;

Goal 3
Broadly works if you remove the references to kits which can't currently be loaded.
Update: now that the kit is published, might be easier.
Goal 4

To load a graph I need to use a breadboard.
import { Board, type ProbeEvent } from "@google-labs/breadboard"; causes an error because it relies on an readFile from fs/promise here. It is only used if we provide a path to loadGraph, Remove the import and dynamically import readFile only when a file path is included:

export const loadGraph = async (path?: string, ref?: string) => {
  if (path) {
     const { readFile } = await import("node:fs/promise")
     return JSON.parse(await readFile(path, "utf-8"));
  }
  if (!ref) throw new Error("To include, we need a path or a $ref");
  const response = await fetch(ref);
  return await response.json();
};

Update: Tested and it stops the error.

KitLoader fails to dynamically import using vite as a bundler. When people are building sites they tend to use a bundler, and the bundler has to know about all the assets it needs to compile. I was trying simplest.json and it includes a kit "url": "npm:@google-labs/llm-starter" which will not be able to be loaded in the browser because the bundler 1) doesn't know about it, and 2) if we changed it to "http:" for a dynamic import we'd need to host it some where.

Note: maybe just copy it in for now?
Update: URLs have to be "Npm spec"... weird.

Could Goal 2 be #49?

Could Goal 2 be #49?

Yes, I think it could.

@PaulKinlan  is this done?

🥳


feat(design-system): add curated variant to the suggestion

EX-5290
Motivation and context
The curated variant had to be added to the next queries in the design system. To do this be opted to make this general to all suggestions. And in a similar fashion to what was done in EX-5088.
Type of change

[ ] Bug fix (non-breaking change that fixes an issue)
[X] New feature (non-breaking change that adds functionality)
[ ] Breaking change (fix or feature that causes existing functionality to not work as expected)
[ ] Change requires a documentation update

What is the destination branch of this PR?

[X] Main
[ ] Other. Specify:

How has this been tested?
New sub-sections were added to the Suggestions section in the Design System layout. Any change in the tokens for the curated suggestions will be reflected there and only affect curated suggestions.

Given that this moves the curated highlighting logic to the Suggestion.vue component I think that the code in the NextQuery.vue component is no longer necessary (I'm talking about the shouldHighlightCurated method). This would also affect the tests of the component if it's removed, so those tests would have to be done in the Suggestions test file.
If we have to make that change I can do it in this PR or open a new task (or subtask of the parent of this PR).

Given that this moves the curated highlighting logic to the Suggestion.vue component I think that the code in the NextQuery.vue component is no longer necessary (I'm talking about the shouldHighlightCurated method). This would also affect the tests of the component if it's removed, so those tests would have to be done in the Suggestions test file.
If we have to make that change I can do it in this PR or open a new task (or subtask of the parent of this PR).

Yes, in this case we have to remove the shouldHighlightCurated function and all the references in the next-query.vue compnent

Given that this moves the curated highlighting logic to the Suggestion.vue component I think that the code in the NextQuery.vue component is no longer necessary (I'm talking about the shouldHighlightCurated method). This would also affect the tests of the component if it's removed, so those tests would have to be done in the Suggestions test file.
If we have to make that change I can do it in this PR or open a new task (or subtask of the parent of this PR).

We can extract the shouldHightlightCurated logic (with the highlightCurated prop) to a mixin, as it is used in multiple components (related-tag.vue, base-suggestion.vue and next-query.vue).
Here you have an example implementation:
// is-curated.mixin.ts

import Vue from 'vue';
import Component from 'vue-class-component';
import { Prop } from 'vue-property-decorator';

/**
 * Mixin to facilitate the check of the isCurated state of an entity.
 *
 * @public
 */
@Component
export class IsCuratedMixin<EntityType extends { isCurated?: boolean }> extends Vue {
  /**
   * Indicates if the curated entity should be highlighted.
   *
   * @public
   */
  @Prop({ default: false })
  protected highlightCurated!: boolean;

  /**
   * The entity to check the curated state.
   *
   * @public
   */
  protected entity!: EntityType;

  /**
   * Checks if the entity is curated and if it should be highlighted.
   *
   * @returns True if the entity is curated and should be highlighted.
   *
   * @public
   */
  protected get shouldHighlightCurated(): boolean {
    return this.highlightCurated && !!this.entity.isCurated;
  }
}

This way, you can use it in those components like this:
export default class RelatedTag extends IsCuratedMixin<RelatedTagModel> {
export default class BaseSuggestion extends IsCuratedMixin<Suggestion> {
export default class NextQuery extends IsCuratedMixin<NextQueryModel> {


Session doesn't time out and User session extension option also not available to user, Admin issue.

Describe the bug
When user session times out , the pop up for extending the user session not available to user. And also session doesn't time out.
To Reproduce
Steps to reproduce the behavior:
Go to Admin  (http://localhost:9992/cm/app/?view=workflow&pathType=unknown)
Leave the screen idle for the same duration which configured under  tag in Config.xml file.
Session doesn't time out and Pop up for extending session not available to user
Expected behavior
Session should time out after the screen is left idle for the interval specified  in Config.xml file gets over and a popup for extending session should appear.
Additional context
Navigate all the options available for similar issue and fix.

Duplicate issue. Similar issue is #832. So closing this.


Cannot use DBDataReader as Structured SQL Parameter with 2.0 Update

This article details how to use a DBDataReader as a Structured input parameter to a SQL query:
https://docs.microsoft.com/en-us/dotnet/framework/data/adonet/sql/table-valued-parameters
This worked just fine with Core 1.1, but since I updated to Core 2.0, it no longer works.  If I use DataTable as input, instead of a DBDataReader, the exact same code works.
The error I get is:
"Specified method is not supported"
at System.Data.SqlClient.TdsParser.TdsExecuteRPC(_SqlRPC[] rpcArray, Int32 timeout, Boolean inSchema, TdsParserStateObject stateObj, Boolean isCommandProc, Boolean sync, TaskCompletionSource1 completion, Int32 startRpc, Int32 startParam)    at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds)    at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, TaskCompletionSource1 completion, Int32 timeout, Task& task, Boolean asyncWrite, String method)
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader()

Confirmed, same here.

Issue moved to dotnet/corefx #24502 via ZenHub


Switch SociIndexGenerator runtime to provided.al2

Hello,
since AWS is deprecating go1.x Lambda runtime at the end of this year I am wondering if we can expect to switch runtime environment for SociIndexGenerator function on the repo to use provided.al2.
Kind regards

Resolved: #42


vdisks_apis: delete non-existing vdisk returns 204 instead of 404

API
DELETE /vdisks/{vdiskid}
request & response

###software version
grid faeae03
jumpscale 92c7a2d


Basic support for in-url args

Addresses #5955

Hey @rjharmon, thanks for the PR. To be blunt, I don't fully understand this. think you're attempting to add more complicated path matching to the <Route>, yes? It would be easier to understand what you're trying to do if you more explicitly explained with example code.
// e.g.
// given the url /something/one/two
<Route path='/something/' ... />

One of the goals with React Router is to provide a simple API, not to do everything for you. I'm open to being convinced otherwise, but right now I just don't see this being more than a niche functionality that would be best left to custom components, not a part of the core.

Closing per https://github.com/ReactTraining/react-router/issues/5955#issuecomment-366707858


updating data from back end data using Http but im getting Error

im updating data but using angular 4 in  server backend application Http

Please ask the question to stackoverflow, this is not a zone.js issue.

thanks


Fix setting substate client storage

We were resetting the state when hydrating the client storage, making the tab lose state on refresh.

Pushed a fix for the flaky cookie test


TestContext.CurrentContext.TestDirectory makes GUI crash/not load

We have a test bench with a ton of tests and adding the above mentioned function into the code (so it reads from the right config file) makes the GUI crash / not load at all. Without that function the config is not detected in the right path and therefore gives tests errors, but it loads the GUI up perfectly.

Hi @wanted156. Can you provide some more information (e.g. a minimal reproduction that demonstrates the problem). I just tried to load an assembly with the following "test" and it loaded and ran successfully.

Hi @mikkelbu, letting the GUI run a while longer made it fully load, but it took 5 hours. Without the function it takes around ~7 minutes. It doesn't make any difference on smaller test benches, but it makes a huge one on the bigger ones. So i suppose it's some kind of optimisation issue?
55.417 tests in the package, that's where it stutters, on other test benches (tried up to 2000 tests) it did not make any difference.

@wanted156 Are you saying you have to have a lot of tests and access TestDirectory?
Is all your usage like @mikkelbu 's, that is right in the test method? It makes a difference if you are using it before test execution starts.

@CharliePoole I have a lot of tests and i call the function before I start loading the configuration from a file.
public static void LoadConfig() {             Directory.SetCurrentDirectory(TestContext.CurrentContext.TestDirectory);             IniFile initialisation = new IniFile(IniPath + IniFile); // Both defined as constants             LOG.Fatal("Load data from " + IniFile);             //rest of the code }
That is the only occurance in the testbench where the function is being used. Removing that line makes the GUI load up way faster.  How are you making that happen? That is, from where do you make the call to LoadConfig?

@CharliePoole I've got the function call in a couple of tests, CommWrapper, USim and and F23_Simulator. Those tests are calling the LoadConfig() function that is implemented in my globals class. The other tests do not call the function before they are executed

I asked because you said this runs first, before any tests. So if the test calls them that's not before but during. The distinction is super important since NUnit is in a different state in the two cases.

Hi, i'm so sorry i did not reply sooner but i completely forgot about this.
So to make everything a bit clearer:
I have a method - LoadConfiguration in my Globals class that is being called in the Globals constructor. I also call the method when i'm creating a new instance of a different class in the FixtureSetup that has the OneTimeSetUpAttribute. The LoadConfiguration is also being called before i run any tests and it's being called from a method with the STAThreadAttribute and OneTimeSetUpAttribute. The test does NOT call it because it's being called before the tests start.
I hope anything makes more sense now


Semantic UI website sources?

Are the Semantic UI website source are available on github?
Amazing job and would be very interested to look how it was done

There are some examples (https://github.com/Semantic-Org/Semantic-UI/tree/master/examples) but there is a thread #1837  that I believe is related.

It's a docpad server, you can run locally if you follow the instructions in the readme.
https://github.com/Semantic-Org/Semantic-UI-Docs


SSE support

Support SSE in OpenSDS. This PR adds support for the server generated random key encryption. The SSE-C and SSE-KMS are not targeted for DAITO:
Fixes the SSE related issue for DAITO: fixes #634 #638
Special notes for your reviewer:
Release note:

Further, in the current code, I am yet to get enough details on the following topics, will integrate my code with these once I have the information and complete the production testing with docker

1. AK-SK
2. Policies
3. Tenant ID

Tested the following on my local environment (without docker), using postman
1. PUT SSE option on bucket
2. GET SSE option on listing buckets
3. Encrypt data byte[ ] on PUT object

@skdwriting @wisererik @sfzeng @nguptaopensds @kumarashit @anvithks @sunfch  please review, thanks

@rhsakarpos Please update the micro and pb files conflict

@rhsakarpos Can you please check to resolve conflicts and then we will check how to handle the CI issue by issuing /retest

closing this due to some CI issues and merge conflicts, opened #758

closing this due to some CI issues and merge conflicts, opened #758


Export study failed with LesionTracker

At study list, I can export study successfully with OHIFViewer.
However, I got export failed with LesionTracker.
I got console error:
GET http://<IP_ADDRESS>:4000/__wado_proxy?........ 401 (Unauthorized)
I already logged in and then export.
Does anyone give me why?

We're getting ready to formally announce version 2 of the OHIF Viewer. After the announcement, version 1 issues will receive lower priority support. As this issue is a bit stale, I'm going to close it for now.
For future issues, if you include a minimal reproduction, it is easier for us to jump in and help. Unfortunately, there is very little to go off of in your original issue description. I hope you were eventually able to work things out! ^_^


Automatically generate a tfvars similar to the debug file terragrunt-debug.tfvars.json

Describe the enhancement
I would like terragrunt to automatically generate a tfvars/json based on the variables passed into the module (similar to how terragrunt debug generates a terragrunt-debug.tfvars.json file).
Additional context
We use a single (yaml) file to store our variables since variables are repetitive between modules i.e environment: dev. The yaml file is sourced in each terragrunt file. As we have scaled, terragrunt is becoming slower and slower. We want to introduce change detection so only changed terragrunt files are planned/applied.
Things you might want to address include:

[ ] Changes required.
[ ] Implications of the feature.
[x] Alternatives considered.
[ ] Level of effort.

PoC (Proof of Concept)
Link to a Proof of Concept if you have one:

[x] N/A

Including a PoC can help others understand the feature better and implement it faster.
RFC Not Needed

[x] Need to understand terragrunt logical a little more to determine if an RFC is required.

Hey @nikskiz ,
Why aren't you using --terragrunt-debug if that's the behavior you're looking for?

@yhakbar Thanks for the suggestion. That is what I am looking for. I can't believe I missed that. I was under the impression that  --terragrunt-debug will produce debug logs which we wanted to avoid, but that is only the case when used with --terragrunt-log-level debug.


<EMAIL_ADDRESS>

Tips before filing an issue

Have you gone through our FAQs?

Join the mailing list to engage in conversations and get faster support at<EMAIL_ADDRESS>

If you have triaged this as a bug, then file an issue directly.

Describe the problem you faced
A clear and concise description of the problem.
To Reproduce
Steps to reproduce the behavior:

Expected behavior
A clear and concise description of what you expected to happen.
Environment Description

Hudi version :

Spark version :

Hive version :

Hadoop version :

Storage (HDFS/S3/GCS..) :

Running on Docker? (yes/no) :

Additional context
Add any other context about the problem here.
Stacktrace
Add the stacktrace of the error.

Tips before filing an issue

Have you gone through our FAQs?
Join the mailing list to engage in conversations and get faster support at<EMAIL_ADDRESS>If you have triaged this as a bug, then file an issue directly.

Describe the problem you faced
A clear and concise description of the problem.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
A clear and concise description of what you expected to happen.
Environment Description

Hudi version :
Spark version :
Hive version :
Hadoop version :
Storage (HDFS/S3/GCS..) :
Running on Docker? (yes/no) :

Additional context
Add any other context about the problem here.
Stacktrace
Add the stacktrace of the error.

Hi, @c-f-cooper do you want to join on hudi-slack? you can click here and put your email.
https://join.slack.com/t/apache-hudi/shared_invite/enQtODYyNDAxNzc5MTg2LTE5OTBlYmVhYjM0N2ZhOTJjOWM4YzBmMWU2MjZjMGE4NDc5ZDFiOGQ2N2VkYTVkNzU3ZDQ4OTI1NmFmYWQ0NzE

close for no further feedback.


maintain state of the aside

I have a navigation hierarchy that I am trying to show in the aside panel, but the problem is every time the aside opens it refreshes the controller and thus the scope is not maintained, for my use case I want to show user his current position in hierarchy. Is there any way I can accomplish this using Aside?

Using a service you could maintain the state across app.


Annotate structs to not serialize Option fields when value is None

Without this patch target-gen generates fields with value ~

Just wondering, is there a problem with the ~ value? It seems to work fine for both serialising and deserialising, and is standard YAML from what I understand.

I would guess probe-rs-t2rust does not handle it properly because I get compilation errors (they difficult to copy here because the line >115KB long):
error: expected expression, found `,`
 --> /home/mbrossard/git/rust/probe-rs/probe-rs/target/debug/build/probe-rs-cf007d4563158595/out/targets.rs:1:115809


README.md does not explain what this library is or what it does

It would be helpful if the first paragraph of the README.md explains what this library is, what it does and also mention lower level libraries it uses (boto3).
Pull request https://github.com/teaglebuilt/robotframework-AWS/pull/12 fixes this.

thanks @adrianyorke


Reproducing the pretrain results on COCO+VG +CC+SBU

Hi @LiJunnan1992, thank you for great work!
I'm trying to reproduce the pretraining on the CC + COCO + SBU + VG dataset. I get higher losses than yours reported here https://github.com/salesforce/BLIP/issues/19#issuecomment-1046398252
I use the following dataset:

COCO (https://storage.googleapis.com/sfr-vision-language-research/datasets/coco_karpathy_train.json)
Visual genome (https://storage.googleapis.com/sfr-vision-language-research/datasets/vg_caption.json)
CC3M+CC12M+SBU: Filtered web caption (https://storage.googleapis.com/sfr-vision-language-research/BLIP/datasets/ccs_filtered.json)
CC3M+CC12M+SBU: Filtered synthetic caption by ViT-L (https://storage.googleapis.com/sfr-vision-language-research/BLIP/datasets/ccs_synthetic_filtered_large.json)

I didn't balance these datasets. I took the pretrain yaml config from here https://github.com/salesforce/BLIP/blob/main/configs/pretrain.yaml and added new datasets to the training.
Could you please share your yaml config for pretraining on the CC + COCO + SBU + VG dataset ?

Hi @dyashuni, thanks for your interest.
Could you take a look at our LAVIS library? https://github.com/salesforce/LAVIS
It supports BLIP pre-training among other functions.

@LiJunnan1992 thank you, I will take a look at LAVIS

Hi @LiJunnan1992 !
I finetuned 3 pretrained models on a COCO caption task using train_caption.py. I used 32 GPU for pretraining.

BLIP w/ ViT-B 14M https://storage.googleapis.com/sfr-vision-language-research/BLIP/models/model_base_14M.pth
BLIP w/ ViT-B 129M https://storage.googleapis.com/sfr-vision-language-research/BLIP/models/model_base.pth
BLIP w/ ViT-B and CapFilt-L 129M https://storage.googleapis.com/sfr-vision-language-research/BLIP/models/model_base_capfilt_large.pth

And got the following metrics:

BLIP w/ ViT-B 14M images: "val_Bleu_4": 0.403 "val_CIDEr": 1.324
BLIP w/ ViT-B 129M images: "val_Bleu_4": 0.397 "val_CIDEr": 1.318
BLIP w/ ViT-B and CapFilt-L 129M images: "val_Bleu_4": 0.403 "val_CIDEr": 1.338

Model BLIP w/ ViT-B 14M performs almost the same as BLIP w/ ViT-B and CapFilt-L 129M. That contradicts published results...
How is it possible?

Could you reproduce BLIP's fine-tuning result if you use the same setting?
" I used 32 GPU for pretraining." -> I assume that you mean "finetuning"?

I used your config caption_coco.yaml for finetuning. So I used your params.
How many GPUs did you use for finetuning?
" I used 32 GPU for pretraining." -> I assume that you mean "finetuning"? Yes, thank you

I used 8 GPUs. With 32 GPUs, you should set batch_size=8 so that the total batch size remains 256.

Thank you! I will try it.