Relate control flow to conditional types in return types

Search Terms
control flow conditional return type cannot assign extends
Suggestion
Developers are eager to use conditional types in functions, but this is unergonomic:
type Person = { name: string; address: string; };
type Website = { name: string; url: URL };
declare function isWebsite(w: any): w is Website;
declare function isPerson(p: any): p is Person;

function getAddress<T extends Person | Website>(obj: T): T extends Person ? string : URL {
  if (isWebsite(obj)) {
    // Error
    return obj.url;
  } else if (isPerson(obj)) {
    // Another error
    return obj.address;
  }
  throw new Error('oops');
}

The errors here originate in the basic logic:

obj.url is a URL, and a URL isn't a T extends Person ? string : URL

By some mechanism, this function should not have an error.
Dead Ends
The current logic is that all function return expressions must be assignable to the explicit return type annotation (if one exists), otherwise an error occurs.
A tempting idea is to change the logic to "Collect the return type (using control flow to generate conditional types) and compare that to the annotated return type". This would be a bad idea because the function implementation would effectively reappear in the return type:
function isValidPassword<T extends string>(s: T) {
  if (s === "very_magic") {
    return true;
  }
  return false;
}

// Generated .d.ts
function isValidPassword<T extends string>(s: T): T extends "very_magic" ? true : false;

For more complex implementation bodies, you could imagine extremely large conditional types being generated. This would be Bad; in most cases functions don't intend to reveal large logic graphs to outside callers or guarantee that that is their implementation.
Proposal Sketch
The basic idea is to modify the contextual typing logic for return expressions:
type SomeConditionalType<T> = T extends string ? 1 : -1;
function fn<T>(arg: T): SomeConditionalType<T> {
    if (typeof arg === "string") {
        return 1;
    } else {
        return -1;
    }
}

Normally return 1; would evaluate 1's type to the simple literal type 1, which in turn is not assignable to SomeConditionalType<T>. Instead, in the presence of a conditional contextual type, TS should examine the control flow graph to find narrowings of T and see if it can determine which branch of the conditional type should be chosen (naturally this should occur recursively).
In this case, return 1 would produce the expression type T extends string ? 1 : never and return -1 would produce the expression type T extends string ? never : -1; these two types would both be assignable to the declared return type and the function would check successfully.
Challenges
Control flow analysis currently computes the type of an expression given some node in the graph. This process would be different: The type 1 does not have any clear relation to T. CFA would need to be capable of "looking for" Ts to determine which narrowings are in play that impact the check type of the conditional.
Limitations
Like other approaches from contextual typing, this would not work with certain indirections:
type SomeConditionalType<T> = T extends string ? 1 : -1;
function fn<T>(arg: T): SomeConditionalType<T> {
    let n: -1 | 1;
    if (typeof arg === "string") {
        n = 1;
    } else {
        n = -1;
    }
    // Not able to detect this as a correct return
    return n;
}

Open question: Maybe this isn't specific to return expressions? Perhaps this logic should be in play for all contextual typing, not just return statements:
type SomeConditionalType<T> = T extends string ? 1 : -1;
function fn<T>(arg: T): SomeConditionalType<T> {
    // Seems to be analyzable the same way...
    let n: SomeConditionalType<T>;
    if (typeof arg === "string") {
        n = 1;
    } else {
        n = -1;
    }
    return n;
}

Fallbacks
The proposed behavior would have the benefit that TS would be able to detect "flipped branch" scenarios where the developer accidently inverted the conditional (returning a when they should have returned b and vice versa).
That said, if we can't make this work, it's tempting to just change assignability rules specifically for return to allow returns that correspond to either side of the conditional - the status quo of requiring very unsafe casts everywhere is not great. We'd miss the directionality detection but that'd be a step up from having totally unsound casts on all branches.
Use Cases / Examples
TODO: Many issues have been filed on this already; link them
Workarounds
// Write-once helper
function conditionalProducingIf<LeftIn, RightIn, LeftOut, RightOut, Arg extends LeftIn | RightIn>(
    arg: Arg,
    cond: (arg: LeftIn | RightIn) => arg is LeftIn,
    produceLeftOut: (arg: LeftIn) => LeftOut,
    produceRightOut: (arg: RightIn) => RightOut):
    Arg extends LeftIn ? LeftOut : RightOut
{
    type OK = Arg extends LeftIn ? LeftOut : RightOut;
    if (cond(arg)) {
        return produceLeftOut(arg) as OK;
    } else {
        return produceRightOut(arg as RightIn) as OK;
    }
}

// Write-once helper
function isString(arg: any): arg is string {
    return typeof arg === "string";
}

// Inferred type
// fn: (arg: T) => T extends string ? 1 : -1
function fn<T>(arg: T) {
    return conditionalProducingIf(arg, isString,
        () => 1 as const,
        () => -1 as const);
}

let k = fn(""); // 1
let j = fn(false); // -1

Checklist
My suggestion meets these guidelines:

[x] This wouldn't be a breaking change in existing TypeScript/JavaScript code

All of these are errors at the moment

[x] This wouldn't change the runtime behavior of existing JavaScript code
[x] This could be implemented without emitting different JS based on the types of the expressions
[x] This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)
[x] This feature would agree with the rest of TypeScript's Design Goals.

Control flow analysis currently computes the type of an expression given some node in the graph. This process would be different: The type 1 does not have any clear relation to T. CFA would need to be capable of "looking for" Ts to determine which narrowings are in play that impact the check type of the conditional.

FWIW: this is exactly the same problem faced here in #33014.

If generic type parameters could be narrowed via control flow analysis then perhaps this would also address #13995?

I don't think this is really a solution to type parameter narrowing in general. There are ways that this could be unsound because of the previously discussed points where a type guard doesn't provide sufficient information to narrow a type-variable. Two examples:
// Example 1.
type HasX = { x: number }
function hasX(value: unknown): value is HasX {
    return typeof value === "object" && value !== null && typeof (<any>value).x === "number"
}

function foo<T>(point: T): T extends HasX ? number : boolean {
    if (hasX(point)) {
        return point.x
    }
    return false;
}

const point: { x: number | boolean } = { x: 3 };
const b: boolean = foo(point);

// Example 2.
type SomeConditionalType<T> = T extends string ? 1 : -1;
function fn<T>(arg: T): SomeConditionalType<T> {
    if (typeof arg === "string") {
        return 1;
    } else {
        return -1;
    }
}

const shouldBe1: -1 = fn("a string" as unknown);
const isOne: 1 = fn("a string");
const isOneMaybe: 1 | - 1 = fn("a string" as string | number);

I think the solution is relying on two points: the conditional type is distributive, and the constraint of the check type is 'filterable' with respect to the extends type in each conditional type. That is:
Given a type parameter T extends C, and a conditional type T extends U ? A : B, then for all types V:

if V is assignable to C, and U and V are not disjoint
then there is a filtering of V that is assignable to U.

Cross-linking to #22735, the design limitation addressed by this suggestion

Just an SO question as another reference.

As proposed, I think this goes too far in the direction of unsoundness.  Knowing that a value arg of type T is a string doesn't tell you that T extends string, it actually tells you that T is a supertype of string!  This proposal would basically have the compiler analyze your code to see if it might be doing something correct, and then remove errors and the need for casts, which yes does achieve backwards compatibility and reduced errors and casts, but at a high cost in being able to trust the compiler's judgment.
I think a good starting point would be an example function that is self-consistent in terms of its variance.  If fn<string>("x") returns 1 and fn<unknown>("x") returns -1 at the type level, something is already wrong, because a function can't return 1 and -1 for the same input value.
How about something like:
function getTypeCode<T extends number | string>(
  t: T
): T extends number
  ? 'N'
  : T extends string
  ? 'S'
    : 'N' | 'S' {
    if (typeof t === 'number') {
        return 'N'
    } else if (typeof t === 'string') {
        return 'S'
    }
  }

Here each conditional specializes the output for a specialized input, like a type-safe overload.  Analysis should proceed starting from the return type.  If T extends number, does the function return 'N'?  If the compiler can prove that, bingo.

@dgreensp I don't believe the proposal in the OP introduces any novel unsoundness, specifically because the logic is only applied to return expressions which are strictly a covariant position. Can you show an example?

I think my examples here show unsound calls.

@RyanCavanaugh In your example:
function fn<T>(arg: T): T extends string ? 1 : -1 {
    if (typeof arg === "string") {
        return 1;
    } else {
        return -1;
    }
}

Substituting unknown for T:
function fn(arg: unknown): -1 {
    if (typeof arg === "string") {
        return 1; // error
    } else {
        return -1;
    }
}

Or substituting string | number for T:
function fn(arg: string | number): -1 {
    if (typeof arg === "string") {
        return 1; // error
    } else {
        return -1;
    }
}

So I think the compiler should not allow the example.  It would be great to design this feature so that all valid substitutions for T produce valid typings, first, and only be more lenient if that proves too limiting.  Fundamentally, all the compiler can prove at the site of return 1 is that arg is a T and arg is a string.  It does not follow that T extends string, so there's no single branch of the conditional that applies to this return statement.  (The else branch that returns -1 is a different story, as described below, because if T does extend string, then it is unreachable.)
In my example, the same substitutions are correct, for example substituting unknown for T:
function getTypeCode(
  t: unknown
): 'N' | 'S' {
  if (typeof t === 'number') {
      return 'N'
  } else if (typeof t === 'string') {
      return 'S'
  }
}

A safe alternative proposal would be... I think, first allow returning a value that's assignable to all the branches of the conditional return value (or the intersection of the branches).  So in a function whose return value is A extends B ? C : D, you can always return a value of type C & D.  Then omit C at those return sites that are unreachable if A is replaced by B.
In other words, the contextual return type is D in places that are unreachable if A is narrowed to B, and C & D otherwise.
So in the original example:
function fn<T>(arg: T): T extends string ? 1 : -1 {
    if (typeof arg === "string") {
        // contextual type is 1 & -1, so this is an error
        return 1;
    } else {
        // this branch is unreachable in the positive case where T extends string,
        // so contextual type is -1, and this is ok
        return -1;
    }
}

Code that is crafted to be "correct," like my example, will work, as follows:
function getTypeCode<T extends number | string>(
  t: T
): T extends number
  ? 'N'
  : T extends string
  ? 'S'
    : 'N' | 'S' {
    if (typeof t === 'number') {
        // Unreachable when T extends string, so type is 'N' & ('N' | 'S') = 'N'
        return 'N'
    } else if (typeof t === 'string') {
        // Unreachable when T extends number so type is 'S' & ('N' | 'S') = 'S'
        return 'S'
    }
  }

My comment neglects the fact that conditionals distribute over unions.  The
string | number example should be replaced by one using a different super
type/subtype relationship that isn’t a union, like superclass/subclass, and
the proposal may need to be modified.  The bulk of the argument remains the
same.
On Thu, Jan 9, 2020 at 11:35 AM Jack Williams<EMAIL_ADDRESS>wrote:

I think my examples here
https://github.com/microsoft/TypeScript/issues/33912#issuecomment-540501470
show unsound calls.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/microsoft/TypeScript/issues/33912?email_source=notifications&email_token=AABGBJSYR4ETSZH23IENQ3LQ4536NA5CNFSM4I7ERYTKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEIRQDJI#issuecomment-572719525,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AABGBJRKJTQIE7VLLFALVCLQ4536NANCNFSM4I7ERYTA
.

Overloads work for the original example:
function getAddress(obj: Website): URL;
function getAddress(obj: Person): string;
function getAddress(obj:  Website | Person) {
  if (isWebsite(obj)) {
    return obj.url; // no error, error on the overload if the type is changed here
  } else if (isPerson(obj)) {
    return obj.address; // same
  }
  throw new Error('oops');
}

What are they doing different?

Here is another use case where it seems to be the same issue:
https://stackblitz.com/edit/rxjs-wdvejf?file=index.ts
Here a conditional type bound to a method argument and return value are unable to handle the valid cast
type AddressBookEntry<T> = T extends AddressBookEntryType.Business
  ? Business
  : T extends AddressBookEntryType.Person
  ? Person
  : never;

const addressBookMap: Map<
  AddressBookEntryType,
  Map<string, AddressBookEntry<any>>
> = new Map();

const getFromMap = <T extends AddressBookEntryType>(
  key: string,
  entryType: T
): AddressBookEntry<T> => {
  const byTypeMap = addressBookMap.get(entryType);
  if (byTypeMap !== null) {
    return byTypeMap.get(key); // <-- Error:
  // Type 'Business | Person' is not assignable to type 'AddressBookEntry<T>'.
  // Type 'Business' is not assignable to type 'AddressBookEntry<T>'.(2322)
  } else {
    return null;
  }
};

My workaround (in a simpler example from the official documentation) is explicitly casting to the expected type. Even if it is not an elegant solution and requires an intermediate step with <unknown>, the compiler remains silent:
type IdLabel = { id: number };
type NameLabel = { name: string };

type NameOrIdType<T extends number | string> = T extends number
  ? IdLabel
  : NameLabel;

function createLabel<T extends number | string>(
  paramNameOrId: T,
): NameOrIdType<T> {
  if (typeof paramNameOrId === 'string') {
-  return { name: paramNameOrId });
+  return <NameOrIdType<T>>(<unknown>{ name: paramNameOrId });
  } else {
-   return { id: paramNameOrId });
+   return <NameOrIdType<T>>(<unknown>{ id: paramNameOrId });
  }
}

let a = createLabel('typescript'); // { name: 'typescript' }
let b = createLabel(4.1); // { id: 4.1 }

From the documentation specifically on conditional types, it looks like something like this not only should be possible, but a main use case. The same documentation uses this as a replacement for overloads but, from this issue, it looks like there's no other way. In the documented use case, how would one implement createLabel without extra casts?

Overloads (like in @simonbuchan example) is exactly what I would like to do, but with arrow functions - but unfortunately it seems you can't use overloads with arrow functions, at least what I have found so far, without casting the implementation return type to any.
type Overload = {
    (obj: Website): URL;
    (obj: Person): string;
}

const getAddress: Overload = (obj): any /* any required here :-( */ => {
    if (isWebsite(obj)) {
        return obj.url;
    } else if (isPerson(obj)) {
        return obj.address;
    }
    throw new Error('oops');
}

Playground Link

I don't see how the unwieldy inferred return types are a problem. Couldn't you just infer a naïve type but check if an explicit return type annotation exists?
Also, I don't think it's necessary to change the inferred type of the return value, but to, when checking the return type, evaluate the conditional type given the known guards in the control flow.

The problem with using overloads as suggested by @simonbuchan is that there are few checks in place to make sure you don't mess up. Consider this:
type Person = { name: string; address: string; };
type Website = { name: string; url: URL; somethingElse: unknown };
declare function isWebsite(w: any): w is Website;
declare function isPerson(p: any): p is Person;

function getAddress(obj: Website): URL;
function getAddress(obj: Person): string;
function getAddress(obj:  Website | Person) {
  if (isWebsite(obj)) {
    if (typeof obj.somethingElse === 'string') {
        return obj.url;
    }
    return 42; // you'd expect this to cause an error, but it doesn't
  } else if (isPerson(obj)) {
    return obj.address;
  }
  throw new Error('oops');
}

Also, I want to echo @saiichihashimoto 's concerns about conditional types for return functions being still described as possible in the official docs

@lgenzelis it is because the getAddress implementation should specify all the possible types as a union to guarantee proper type checking of its results. Here is fixed example.
function getAddress(obj: Website): URL;
function getAddress(obj: Person): string;
function getAddress(obj:  Website | Person): URL | string {...}

@dvdvdmt but that still doesn't check the developer intention of "this function will return a URL when obj is a Website or a string when obj is a Person". Check the unfixed example :p

Dead Ends
The current logic is that all function return expressions must be assignable to the explicit return type annotation (if one exists), otherwise an error occurs.
A tempting idea is to change the logic to "Collect the return type (using control flow to generate conditional types) and compare that to the annotated return type". This would be a bad idea because the function implementation would effectively reappear in the return type:
function isValidPassword<T extends string>(s: T) {
  if (s === "very_magic") {
    return true;
  }
  return false;
}

// Generated .d.ts
function isValidPassword<T extends string>(s: T): T extends "very_magic" ? true : false;

For more complex implementation bodies, you could imagine extremely large conditional types being generated. This would be Bad; in most cases functions don't intend to reveal large logic graphs to outside callers or guarantee that that is their implementation.

I might be misunderstanding the way Typescript works, but this might not be a dead end, if it is possible to do.
Why not creating a keyword or a special type for this specific case, that relies on typeguards? I am using the name collect in this example, and I consider this similar to infer. I Understand all the inevitable limitations for more complex function implementations, but this would be something that you choose in specific cases, rather than a default behaviour.
From the initial example of getAddress:

type Person = { name: string; address: string; };
type Website = { name: string; url: URL };
declare function isWebsite(w: any): w is Website;
declare function isPerson(p: any): p is Person;

Not sure what to do with error management (using never might not be enough, as you could still use the returned value in some cases, without noticing any issue).
I would actually write the function differently, relying on the expected type (so only one typeguard is necessary):
function getAddress<T extends Person | Website>(obj: T): collect T {
if (isPerson(obj)) {
    return obj.address;
  }
    return obj.url;
}

// Generated .d.ts
function getAddress<T extends Person | Website>(obj: T): T extends Person ? string : URL;

But we could go for something that accept an unknown input and checks all the different types:
function getAddress<T>(obj: T): collect T {
  if (isWebsite(obj)) {
    return obj.url;
  } else if (isPerson(obj)) {
    return obj.address;
  }
}

// Generated .d.ts
function getAddress<T>(obj: T): T extends Website ? URL : T extends Person ? string : undefined;

why this pattern not work ?
	name<T extends string>( name?: T ): T extends string ? this : string {
		if( typeof name === 'undefined' ) return this.root.name;
		this.root.name = name;
		return this;
	}

return this if we pass string.
return string if we pass nothing.

@djmisterjon Because it's not supported (yet). This is exactly what this open issue is about.

Even if it were supported, T extends string ? this : string will always evaluate to this given that T is constrained to string to start with.  Presumably this is a typo/mistake and you mean something like name<T extends [string] | [undefined?]>( ...[name]: T): T extends string ? this : string {}. 🤷♂

Even if it were supported, T extends string ? this : string will always evaluate to this

Or to never. :-)

Is this the right issue to talk about wanting control flow analysis to work on generic conditional types at all?  Even when return types are not technically involved?  For example, does this code belong here?
function foo<T extends string | number>(val: T, obj: { prop: T extends string ? number : string }) {
    if (typeof val === "string") {
        obj.prop = val.length;
    } else {
        obj.prop = val.toFixed(2);
    }
}

Playground link

Not 100% sure that belongs here but I had the issue that I wanted to traverse an object and replace all nulls with undefined but keep the type as close a possible.
You can find my solution here traverse
Snippet:
type Nullish = undefined | null;
type Traversable = Something | Nullish;
type NullToUndefined<T> = T extends null ?
  undefined :
  T extends PlainObject ?
    { [K in keyof T]: NullToUndefined<T[K]>} :
    T extends Array<infer E> ?
    Array<NullToUndefined<E>> :
    T;

function traverse<T extends Traversable>(value: T): NullToUndefined<T>;
function traverse<T extends Traversable>(value: T): unknown {
  if (value === null || value === undefined) return undefined;
  if (!isArray(value) && !isPlainObject(value)) {
    return value;
  }
  if (isArray(value)) {
    return value.map((entry) => isNulish(entry) ? traverse(entry) : traverse(entry));
  }
  return Object.entries(value).reduce((m, [key, keyValue]) => {
    // Must be specific. See https://www.typescriptlang.org/docs/handbook/2/functions.html#writing-good-overloads
    if (isNulish(keyValue)) {
      return {...m, [key]: traverse(keyValue) };
    }
    return {...m, [key]: traverse(keyValue) };
  }, {});
}

But what I do not 100% get and maybe it is related to this issue that I can not replace
function traverse<T extends Traversable>(value: T): NullToUndefined<T>;
function traverse<T extends Traversable>(value: T): unknown {

with
function traverse<T extends Traversable>(value: T): NullToUndefined<T> {

We can come up with myriad ways in which it manifests, but at the root of the issue is a lack of transitivity between the types derived by overloaded functions and the function types from which they were derived. You simply can't start with a type declaration that has variable return types and implement such a function with type safety.
export function doStuff(arg: string): string
export function doStuff(arg: number): number

export function doStuff(arg) {
  return arg
}

// derived as:
// type DoStuff = {
//   (arg: string): string;
//   (arg: number): number;
// }
type DoStuff = typeof doStuff

This is as expected. However, if we started with the type and had to work backwards, it's impossible without an unchecked type assertion:
type DoStuff = {
  (arg: string): string
  (arg: number): number
}

export const doStuff: DoStuff = (
  // `arg` should be inferred as `string | number`
  // but is `any`
  arg,
// result should be inferred as `typeof arg extends string ? string : number`
// but is `any`
) => {
  return arg
}

The issue states the problem as one of referencing control flow to determine the return type. That would definitely be required to implement such a function that infers its return type:
// this should have an inferred type of:
// {
//   (arg: string): string;
//   (arg: number): number;
// }
export const doStuff = (arg: string | number) => {
  if (typeof arg === 'string') {
    return arg + 'foo'
  } else {
    return arg + 2
  }
}

But I think it's rather important to note that we couldn't work out the types even if we explicitly tell the compiler what the "cases" are.

@ehaynes99 Nice clearification of the issue.
Can you elaborate more on "Why this will not be possible?"

I wasn't suggesting that it won't be possible, just that it isn't currently. It's certainly not trivial, as it would have to determine mutual exclusivity of input/output combinations. E.g. here, it's not 1:1 and would have to return string | number.
export const doStuff = (arg: string | number) => {
  if (Date.now() % 2 === 0 && typeof arg === 'string') {
    return arg + 'foo'
  } else {
    return 123
  }
}

Is it planed be implemented in TS?

We can come up with myriad ways in which it manifests, but at the root of the issue is a lack of transitivity between the types derived by overloaded functions and the function types from which they were derived. You simply can't start with a type declaration that has variable return types and implement such a function with type safety.

I think it's some different case. For overloaded functions, compiler should be able to infer it's argument and return type.
function fun(arg: number): string
function fun(arg: string): number
function fun(arg: infer): infer {
//...
}

Compiler can just check implementation for every overload, with substituted types for arg and return.Easy to implement and take away half cases for return conditional types. But, again, it looks like a different issue.

I think it's some different case.
Respectfully disagree. To say that a function has conditional return types is the same as saying it has multiple signatures, otherwise known as an overload. These are identical declarations of a type:

function fun(arg: number): string
function fun(arg: string): number
function fun(arg: infer): infer {
  // ...

and:
type Fun = {
  (arg: string): string
  (arg: number): number
}

const fun: Fun = (arg: infer): infer => {
  // ...
}

Or more specifically applied to the example in issue above:
function getAddress<T extends Person | Website>(obj: T): T extends Person ? string : URL {

is the same as:
type GetAddressFn = {
  (obj: Person): string
  (obj: Website): URL
}
// Doesn't work
const getAddress: GetAddressFn = (obj) => {
  if (isWebsite(obj)) {
    return obj.url;
  } else {
    return obj.address;
  }
}

Compiler can just check implementation for every overload, with substituted types for arg and return.Easy to implement

Not true. That's the issue.

Or more specifically applied to the example in issue above:
function getAddress<T extends Person | Website>(obj: T): T extends Person ? string : URL {

is the same as:
type GetAddressFn = {
  (obj: Person): string
  (obj: Website): URL
}
// Doesn't work
const getAddress: GetAddressFn = (obj) => {
  if (isWebsite(obj)) {
    return obj.url;
  } else {
    return obj.address;
  }
}

nit: as you wrote it, the overload function would reject an argument of type Person | Website whereas the generic version would accept it. It needs an additional overload.
> type GetAddressFn = {
>   (obj: Person): string
>   (obj: Website): URL
>   (obj: Person | Website): string | URL
> }

@ehaynes99

To say that a function has conditional return types is the same as saying it has multiple signatures, otherwise known as an overload.

Yes, but also conditional return type can branch on some external type - for example, methods in generic class can relate to class type parameter, and not to a function arguments. So it's slightly wider than just overloads. And overloads is wider than conditional return type too, since you can express invariants like "all arguments and return type is string, or all of them is number", which is... Can be written via generic functions, of course, but here is much more variants which you can easily express with overloads, just like "it's a single number argument, returning number or string and some options, still returning number".
Also, your original example now correctly infer type of arguments, but still not compiling, exactly because implementation signature isn't compatible with overloads signatures. And in overloaded function, types of arguments isn't inferred, so some inconsistency here... But I still think that issues with overloaded functions is slightly different case (but definitely somehow-related to this issue). So I fill issue with some discussions around it here https://github.com/microsoft/TypeScript/issues/52478
I think, correct and type-safe overloads can handle lion share of cases for this issue, and still much easier to implement.

nit: as you wrote it, the overload function would reject an argument of type Person | Website whereas the generic version would accept it. It needs an additional overload.

Correct you are, but that case already works. :-D

Yes, but also conditional return type can branch on some external type - for example, methods in generic class can relate to class type parameter, and not to a function arguments.

There are no "external types", only types that are in scope:
// same issue
function getAddress<T extends Person | Website>(obj: T) {
  return function inner() {
    return function inner2() {
      return function inner3() {
        return function inner4(): T extends Person ? string : URL {

But I still think that issues with overloaded functions is slightly different case (but definitely somehow-related to this issue). So I fill issue with some discussions around it here #52478

I completely agree that all of the different cases you're bringing up are different cases. :-) All conditional return types are overloads, but not all overloads have conditional return types. You're bringing up a lot of the second case, and those aren't related to this issue.
You opened an issue about overloads, cited my comment as support for it, and then came here to say that it's not the same case as overloads. For the record, I don't care at all about the semantics of the existing overload syntax. It's an anti-feature like enum that I could dispense with entirely if we had a solution that allowed a type definition for overloads independent of implementation. const assertions allows deprecation of enum, and this would allow deprecation of the current version of overloads.

I think, correct and type-safe overloads can handle lion share of cases for this issue, and still much easier to implement.

You've said "easy to implement" a dozen times or so. When people who actively maintain the compiler on a daily basis are telling you otherwise, you're going to need to produce the PR for anyone to believe you.
I don't want to pollute this thread anymore. If you disagree, you can post it in this gist, but you really need to enumerate your cases, because pointing out that there are a lot of different cases without listing them is a poor preface to calling something easy.

Hey @gabritto any update on this? Honestly one of my biggest pains working w/ TypeScript has been these sorts of weird edge cases in the type system. Also, for this example in the docs, it is still not possible to write an implementation that does not require type assertions.

I am slowly working on it. I'm close to having a working prototype, but it's been tricky to make it work in a mostly sound way.

@margaretdax I am slowly working on it. I'm close to having a working prototype, but it's been tricky to make it work in a mostly sound way.
Meanwhile, real world examples of where you'd want to use this feature are more than welcome.

Hello! I think I have a relevant example here:
https://stackoverflow.com/questions/77612251/typescript-conditional-type-depending-on-whether-type-is-undefined

Hello! I think I have a relevant example here: https://stackoverflow.com/questions/77612251/typescript-conditional-type-depending-on-whether-type-is-undefined

Thanks for the example, it has a couple things that don't currently work with my in-progress prototype, but that I hope I can make work.

Here's another, similar to something I recently did around RabbitMQ. Depending on the type of the exchange, I want the signature of a publish function to be different (Rabbit just being an example, so mocking it here):
Playground Link:
type FauxAmqpChannel = {
  publish(exchange: string, routingKey: string, content: string, options?: Record<string, any>): Promise<void>
}

type DirectExchange = { type: 'direct'; name: string }

type DirectPublisher<T> = (routingKey: string, message: T) => Promise<void>

type FanoutExchange = { type: 'fanout'; name: string }

type FanoutPublisher<T> = (message: T) => Promise<void>

type CreatePublisherFn = {
  <T>(channel: FauxAmqpChannel, directExchange: DirectExchange): DirectPublisher<T>
  <T>(channel: FauxAmqpChannel, fanoutExchange: FanoutExchange): FanoutPublisher<T>
}

// Type '(routingKey: string, message: T) => Promise<void>' is not assignable to type 'FanoutPublisher<any>'.
//   Target signature provides too few arguments. Expected 2 or more, but got 1. [2322]
const createPublisher: CreatePublisherFn = (channel, exchange) => {
  if (exchange.type === 'direct') {
    return async (routingKey, message) => {
      await channel.publish(exchange.name, routingKey, JSON.stringify(message))
    }
  } else if (exchange.type === 'fanout') {
    return async (message) => {
      await channel.publish(exchange.name, '', JSON.stringify(message))
    }
  }
  throw new TypeError(`Unknown exchange type: ${exchange}`)
}

declare const channel: FauxAmqpChannel

const directPublisher = createPublisher<string>(channel, { type: 'direct', name: 'direct-exchange' })

const fanoutPublisher = createPublisher<string>(channel, { type: 'fanout', name: 'fanout-exchange' })

The problem is further compounded if you want varying numbers of generic parameters. RabbitMQ has a "topic exchange" that uses structured strings as keys, so it would be nice to be able to strongly type those. The compiler loses all ability to infer input or output types at that point.
Playground Link:
type FauxAmqpChannel = {
  publish(exchange: string, routingKey: string, content: string, options?: Record<string, any>): Promise<void>
}

type DirectExchange = { type: 'direct'; name: string }

type DirectPublisher<T> = (routingKey: string, message: T) => Promise<void>

type FanoutExchange = { type: 'fanout'; name: string }

type FanoutPublisher<T> = (message: T) => Promise<void>

export type TopicExchange<K> = { type: 'topic'; name: string; createKey: (key: K) => string }

export type TopicPublisher<T, K> = (key: K, message: T) => Promise<void>

export type CreatePublisherFn = {
  <T>(channel: FauxAmqpChannel, directExchange: DirectExchange): DirectPublisher<T>
  <T>(channel: FauxAmqpChannel, fanoutExchange: FanoutExchange): FanoutPublisher<T>
  <T, K>(channel: FauxAmqpChannel, topicExchange: TopicExchange<K>): TopicPublisher<T, K>
}

const createPublisher: CreatePublisherFn = (channel, exchange) => {
  if (exchange.type === 'direct') {
    return async (routingKey, message) => {
      await channel.publish(exchange.name, routingKey, JSON.stringify(message))
    }
  } else if (exchange.type === 'fanout') {
    return async (message) => {
      await channel.publish(exchange.name, '', JSON.stringify(message))
    }
  } else if (exchange.type === 'topic') {
    return async (key, message) => {
      const routingKey = exchange.createKey(key)
      await channel.publish(exchange.name, routingKey, JSON.stringify(message))
    }
  }
  throw new TypeError(`Unknown exchange type: ${exchange}`)
}

declare const channel: FauxAmqpChannel

const directPublisher = createPublisher<string>(channel, { type: 'direct', name: 'direct-exchange' })

const fanoutPublisher = createPublisher<string>(channel, { type: 'fanout', name: 'fanout-exchange' })

That case probably makes this more difficult, but it is covered with standard overloading. This is perfectly valid:
type VariablyGeneric = {
  <T>(values: T[]): string
  <K extends string, T>(values: Record<K, T>): string
}

const variablyGeneric: VariablyGeneric = (values: any) => {
  if (Array.isArray(values)) {
    return values.join(', ')
  }
  return Object.values(values).join(', ')
}

Another overloading without usage of any or type assertion:
type Person = { name: string; address: string; };
type Website = { name: string; url: URL };
declare function isWebsite(w: any): w is Website;
declare function isPerson(p: any): p is Person;

function getAddress<T extends ( Person | Website)>(obj: T): T extends Person ? string : URL
function getAddress<T>(obj: T) {
    if (isWebsite(obj))
        return obj.url
    else if (isPerson(obj))
       return obj.address
    throw new Error('oops');
}


Windows Trust Stores do not work if all the certificates in the chain are not in the same "container"

Description
This comes from a comment  that @cbuzzsaw made in #18101 :

Windows Trust Stores don't seem to work as expected.
When simply using the Windows Trust Store, dbeaver cannot validate a certificate issued from an intermediate Issuing CA coupled with the trusted Root CAfrom the Windows Trust Store.
Scenario: Root CA Certificate installed/trusted in Computer's & User's "Trusted Root Certification Authorities" windows store. Intermediate Issuing CA certificate installed/trusted in the Computer's and User's "Intermediate Certification Authorities" windows store. Certificate issued from the Intermediate Issuing CA installed on the database we are connecting to from DBeaver. Windows shows the certificate can be validated, yet DBeaver throws the error mentioned above.
There is something still off when using the new setting under Preferences --> Connections --> Use windows trust store checkbox. When I setup the cacerts file for the java trust store and uncheck the "User Windows trust store" things work as expected. But when setting up the Windows Trust stores properly the connections cannot be established.
We have tested using an internal Certificate Authority and Intermediate Issuing Authority running Microsoft Certificate Services. In powershell (and certificate control panel snapin) the Certificate locations are: Root CA --- Cert:\LocalMachine\Root (Trusted Root Certification Authorities) Intermediate CA ---- Cert:\LocalMachine:\CA (Intermediate Certificate Authorities) Root CA ---- Cert:\CurrentUser\Root (Trusted Root Certification Authorities) Intermediate CA ----- Cert:\CurrentUser\CA (Intermediate Certificate Authorities)
I did validate that this works when all certificates (Root and Intermediates) are in one container such as the "Trusted Root Certification Authorities" however this isn't really how Windows is designed to work. It takes advantage of the different certificate containers. Example of this is where Root certificates are trusted in the "Trusted Root Certificate Authorities" container and intermediaries are stored in the "Intermediate Certification Authorities" container. When the entire chain isn't in a single container DBeaver doesn't validate the certificate properly. To use the dbeaver.ini file you specify -Djavax.net.ssl.trustStoreType=Windows-ROOT, there needs to be a way to specify the Windows-ROOT plus the Windows-CA containers or just have dbeaver use the Certificate store as windows is designed to by taking into consideration all of the trust chains from the different containers, Trusted Certification Authorities, Intermediate Certification Authorities, Third-Party Root Certification Authorities, etc. along with the ability to check for "Untrusted Certificates" specified in that store.

I found myself with exactly this problem. I am in a corporate computer in Windows, I cannot edit my DBeaver installation and therefore I cannot change the cacerts to import a certificate, nor the dbeaver.ini file to use an external JVM where I have write access to the cacerts file. I can install certificates in my user trust stores, though. However, as this is an intermediate authority (not a root authority), the authentication still fails.
DBeaver Version
24.2.4
Operating System
Microsoft Windows 10 Home
Database and driver
Oracle 12c.
Steps to reproduce
No response
Additional context
No response

Thanks for the bug report


Fixes #543 and #542

Also standardizes to XenonException instead of Exception in getException.

Codecov Report

Merging #546 into master will decrease coverage by 0.14%.
The diff coverage is 42.1%.

@@             Coverage Diff              @@
##             master     #546      +/-   ##
============================================
- Coverage     85.18%   85.04%   -0.15%
+ Complexity     1549     1547       -2
============================================
  Files           103      103
  Lines          4625     4634       +9
  Branches        693      693
============================================
+ Hits           3940     3941       +1
- Misses          470      478       +8
  Partials        215      215

Flag
Coverage Δ
Complexity Δ

#fixedclientenvironment
27.42% <0%> (-0.06%)
463 <0> (ø)

#integration
57.83% <36.84%> (-0.12%)
897 <3> (-3)

#livelocal
23.11% <0%> (-0.2%)
371 <0> (-3)

#unit
55.43% <21.05%> (-0.11%)
1140 <4> (ø)

Impacted Files
Coverage Δ
Complexity Δ

...er/xenon/adaptors/schedulers/slurm/SlurmUtils.java
98.66% <ø> (ø)
62 <0> (ø)
:arrow_down:

...ecenter/xenon/adaptors/schedulers/JobExecutor.java
72.34% <0%> (-1.58%)
36 <0> (ø)

...adaptors/schedulers/QueueStatusImplementation.java
84.21% <0%> (-15.79%)
10 <0> (ø)

...n/adaptors/schedulers/JobStatusImplementation.java
66.66% <0%> (-6.67%)
14 <0> (ø)

.../xenon/adaptors/schedulers/ScriptingScheduler.java
78.04% <100%> (ø)
21 <0> (-1)
:arrow_down:

...ors/schedulers/gridengine/GridEngineScheduler.java
84.73% <100%> (ø)
43 <0> (ø)
:arrow_down:

...daptors/schedulers/gridengine/GridEngineUtils.java
94.49% <100%> (ø)
32 <4> (ø)
:arrow_down:

.../xenon/adaptors/schedulers/torque/TorqueUtils.java
92.64% <100%> (ø)
19 <0> (ø)
:arrow_down:

...on/adaptors/schedulers/torque/TorqueScheduler.java
79.39% <66.66%> (ø)
49 <0> (ø)
:arrow_down:

.../adaptors/filesystems/webdav/WebdavFileSystem.java
73.98% <0%> (+0.81%)
24% <0%> (ø)
:arrow_down:

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 facd754...7f238e6. Read the comment docs.


SDR++ Server Support

Whenever I use it with SDR++ Server it crashes. I've also made sure both the server and client have the module enable and working, but it still doesn't work. This would be amazing because the SDR++ Server is the best server since it fast and responsive. And having more advanced controls makes the experience even better.

use my newer source https://github.com/Sultan-papagani/sdrpp_rtlsdr_source
it supports sdr++ server. just follow the instructions for sdr++ server, Thanks!


adding Scheduled phase to VMI

Short description:
adding Scheduled phase to VMI
More details:
adding Scheduled phase to VMI becaise its missing, and need to test all phases for T2 tests
What this PR does / why we need it:
require to add Scheduled phase in order to test T2
Which issue(s) this PR fixes:
Fixing the needs to inheritance the Scheduled phase rather than hard code
Special notes for reviewer:
none
Bug:
none

not relevant


platform local:drush-aliases --group=foo fails when run remotely

I've successfully authenticated with the CLI remotely using an API token but when I run the following (also remotely):
platform local:drush-aliases --group=foo

I get the error:
[LoginRequiredException]
Not logged in.

I can run platform build remotely without errors. I can also run platform local:drush-aliases --pipe. 👍
Background: I'm attempting this "remotely" via an Ansible role I'm writing to take some of the repetition out of project setup in local Vagrant development. Maybe that's weird, happy to provide more info if required.

Uuugh, my apologies, please disregard this issue. Was running the command as root :)


Error correction for autosym issues in NWChem

Description
NWChem has issues with symmetry detection, that can be avoided by altering the symmetry detection routine.
Here is a prototype for allowing QCEngine to diagnose the problem, apply the change, and re-run the executable.
This kind of auto-corrections raises many issues that I'd like to discuss, such as:

Is such a change to the input file, in the QCFractal sense, running a different calculation? Where do we draw the line on acceptable changes?
Is it worth making this framework for "correctable errors" more general?
Should we adopt a policy similar to random errors - a "CorrectableError" - and give the high level compute function control over how many mitigations are attempted (if any)?

What are your thoughts?
Changelog description
Error correction for autosym issues in NWChem
Status

[x] Code base linted
[ ] Ready to go

Definitely worth making a more general framework. A few notes:

It seems like protocols could control the level and detail of autocorrection and restarting.
There are various buckets of autocorrection
Being able to register corrections is a good design pattern for this.
Keeping track of which corrections were applied is crucial and in what order.
Some layers of this could impact Fractal, but as long as the QCEngine version and correct "level" is recorded it should work just fine.

Thanks for the advice. I'll play around with making a more generalized version of this and get back to you.
I'm leaning going the route of making a CorrectableError exception class that is caught in qcng.compute(), rather than deferring to the Harness (as I have it here)

I implemented a more general approach for the error correcting, which is ready for suggestions.
What would you recommend for keeping track of which corrections are made?
custodian includes a specification scheme for marking what changes are made to an input file, but I'm not sure I want to go to that level of complexity. I do see the advantage of storing the actual changes made rather than only storing the name of the problem encountered (as shown now).
My reasoning for storing "error name only" is that the names of the errors and QCEngine versions maintains the ability to re-generate the same inputs but without the need for a unified specification language that works for all QCEngine codes. We loose a human-interpretable list of the changes applied to the inputs, though I could probably add in human-readable descriptions of what changes are made.

I had forgotten error correction happens in two repositories. Is this PR near RTG after rebase?

I think it should be OK. I'll sync with master and push a revised version

I'm starting to work on this again, but got distracted with a different PR.

I'm going to close this PR and start again.
After more experience and thought, I'd like to revise how Harnesses should respond to errors. Instead of relying on the harness to implement correct code specific to each error type in the "input file writer" part, we should have the error objects themselves alter the input options passed to the input file writer (which will have no logic relating to error correction).This would mimic how Materials Project performs error correction and, if I recall correctly, was what @dgasmith was suggesting all along :)

👍  Thanks for working through this, we had a window for a simpler approach and I'm glad you explored it. The MP approach will be a bit more complex, but I think we have seen signs that it works well so putting in the dev time there will produce a good result!


Please make this an actual usable Program.

If you want to help anime fans go please put this as a application and not some code bs.

You sound like a child. the setup is incredibly easy and using it is even easier. if you need help im sure anyone here would be ready and willing

Its about installing it , using i guess is not as annoying.

So i sound like a child cuz im not that tech savy ? Fucking Gatekeeping Shitter.

youre... not coding anything... its a one-line install. the instructions are incredibly simple

To be fair the sites "supported" are mostly broken. Let us consider:
  adlwrap() {
    declare -a provider=(animepahe animeflix animefreak animeflv anistream gogoanime kissanime kisscartoon twist.moe itsaturday)
    for k in $provider; do
        printf "\n\033[0;31m%s\n" "PROVIDER: $k"
        anime dl "$1" --episodes "$2" --provider "$k" --play mpv; done
  }

The above is just a simple function I have to go through all the providers. Given that let's try Death Note, one of the most popular anime of all time:
$ adlwrap "death note" "1"

Given that search.... only animepahe and anistream actually work. animeflix seems to hang, kissanime requires nodejs and even then is shotty at best and 9anime is basically broken due to captcha.

LOG
PROVIDER: animepahe
anime: anime-downloader 4.0.1
+--------+--------------------+--------+
|      2 | Death Note Rewrite |        |
|      1 | Death Note         |        |
|--------+--------------------+--------|
|   SlNo | Title              | Meta   |
+--------+--------------------+--------+
Enter the anime no:  [1]:
anime: Selected Death Note
anime: Extracting episode info from page
anime: Found anime: Death Note
[ffmpeg/demuxer] mov,mp4,m4a,3gp,3g2,mj2: Referenced QT chapter track not found
(+) Video --vid=1 (*) (h264 1920x1080 23.976fps)
(+) Audio --aid=1 (*) (aac 2ch 48000Hz)
AO: [pulse] 48000Hz stereo 2ch float
VO: [gpu] 1920x1080 yuv420p
AV: 00:00:00 / 00:22:57 (0%) A-V:  0.000 Cache: 9.5s/3MB
Saving state.

Exiting... (Quit)

PROVIDER: animeflix
anime: anime-downloader 4.0.1

^C
Aborted!

PROVIDER: animefreak
anime: anime-downloader 4.0.1
ERROR: 404 Client Error: Not Found for url: https://www.animefreak.tv/search/topSearch?q=death+note

PROVIDER: animeflv
anime: anime-downloader 4.0.1
+--------+------------+--------+
|      1 | Death Note |        |
|--------+------------+--------|
|   SlNo | Title      | Meta   |
+--------+------------+--------+
Enter the anime no:  [1]:
anime: Selected Death Note
anime: Extracting episode info from page
anime: Found anime: Death Note
anime: Quality 1080p not found. Trying 720p.
anime: Quality 720p not found. Trying 480p.
anime: Quality 480p not found. Trying 360p.
anime: Skipping episode: 1
ERROR: ('No supported host server found.  Try another site.', 'https://animeflv.net/ver/141/death-note-1')

PROVIDER: anistream
anime: anime-downloader 4.0.1
+--------+-----------------------------------+--------+
|      4 | Death Note: L - Change the World  |        |
|      3 | Death Note Movie 2: The Last Name |        |
|      2 | Death Note Movie 1                |        |
|      1 | Death Note                        |        |
|--------+-----------------------------------+--------|
|   SlNo | Title                             | Meta   |
+--------+-----------------------------------+--------+
Enter the anime no:  [1]:
anime: Selected Death Note
anime: Extracting episode info from page
anime: Found anime: Death Note
(+) Video --vid=1 (*) (h264 512x288 23.976fps)
(+) Audio --aid=1 (*) (aac 1ch 48000Hz)
AO: [pulse] 48000Hz stereo 2ch float
VO: [gpu] 512x288 yuv420p
AV: 00:00:01 / 00:20:00 (0%) A-V:  0.000 Cache: 303s/13MB
Saving state.

Exiting... (Quit)

PROVIDER: gogoanime
anime: anime-downloader 4.0.1
+--------+-----------------------------------------+--------+
|      4 | Death Note Rewrite: The Visualizing God |        |
|      3 | Death Note Rewrite 2: L’s Successors    |        |
|      2 | Death Note (Dub)                        |        |
|      1 | Death Note                              |        |
|--------+-----------------------------------------+--------|
|   SlNo | Title                                   | Meta   |
+--------+-----------------------------------------+--------+
Enter the anime no:  [1]:
anime: Selected Death Note
anime: Extracting episode info from page
anime: Found anime: Death Note
Failed to open https://st1x.cdnfile.info/user1342/92bd0b67e03416084ffd8bb811b736ff/EP.1.mp4?token=UBHX9QQbIOmGBM3tiMgxOA&expires=1578568094&id=10624&title=(orginalP - mp4) Death+Note+Episode+1.
Saving state.

Exiting... (Quit)

Aborted!

PROVIDER: kissanime
anime: anime-downloader 4.0.1
ERROR: Missing Node.js runtime. Node is required and must be in the PATH (check with `node -v`). Your Node binary may be called `nodejs` rather than `node`, in which case you may need to run `apt-get install nodejs-legacy` on some Debian-based systems. (Please read the cfscrape README's Dependencies section: https://github.com/Anorov/cloudflare-scrape#dependencies.

PROVIDER: kisscartoon
anime: anime-downloader 4.0.1
ERROR: Missing Node.js runtime. Node is required and must be in the PATH (check with `node -v`). Your Node binary may be called `nodejs` rather than `node`, in which case you may need to run `apt-get install nodejs-legacy` on some Debian-based systems. (Please read the cfscrape README's Dependencies section: https://github.com/Anorov/cloudflare-scrape#dependencies.

PROVIDER: twist.moe
anime: anime-downloader 4.0.1
ERROR: [Errno 2] No such file or directory: 'node'

PROVIDER: itsaturday
anime: anime-downloader 4.0.1
+--------+---------+--------+
|--------+---------+--------|
| SlNo   | Title   | Meta   |
+--------+---------+--------+
anime: No such Anime found. Please ensure correct spelling.

Let us also consider a more optimistic result:
$ adlwrap "aho girl" "1"

This time we have a bit more success. The following providers actually... provided: animepahe, animeflix, animefreak, anistream, gogoanime.

LOG
PROVIDER: animepahe
anime: anime-downloader 4.0.1
+--------+----------+--------+
|      1 | Aho Girl |        |
|--------+----------+--------|
|   SlNo | Title    | Meta   |
+--------+----------+--------+
Enter the anime no:  [1]:
anime: Selected Aho Girl
anime: Extracting episode info from page
anime: Found anime: Aho Girl
[ffmpeg/demuxer] mov,mp4,m4a,3gp,3g2,mj2: Referenced QT chapter track not found
(+) Video --vid=1 (*) (h264 1920x1080 23.976fps)
(+) Audio --aid=1 (*) (aac 2ch 48000Hz)
AO: [pulse] 48000Hz stereo 2ch float
VO: [gpu] 1920x1080 yuv420p
AV: 00:00:01 / 00:12:32 (0%) A-V:  0.000 Cache: 42s/5MB
Saving state.

Exiting... (Quit)

PROVIDER: animeflix
anime: anime-downloader 4.0.1
+--------+----------------------------------+--------+
|     10 | Rolling☆Girls                    |        |
|      9 | Toki wo Kakeru Shoujo            |        |
|      8 | Sora wo Kakeru Shoujo            |        |
|      7 | Girls & Panzer                   |        |
|      6 | RDG: Red Data Girl               |        |
|      5 | Gunslinger Girl: Il Teatrino OVA |        |
|      4 | Gunslinger Girl                  |        |
|      3 | Battle Girl High School          |        |
|      2 | Gunslinger Girl: Il Teatrino     |        |
|      1 | Aho Girl                         |        |
|--------+----------------------------------+--------|
|   SlNo | Title                            | Meta   |
+--------+----------------------------------+--------+
Enter the anime no:  [1]:
anime: Selected Aho Girl
anime: Extracting episode info from page
anime: Found anime:
(+) Video --vid=1 (*) (h264 1920x1080 23.977fps)
(+) Audio --aid=1 --alang=jpn (*) (aac 2ch 48000Hz)
File tags:
Title: [RH] Aho Girl - 01 [WebRip] [Hi10] [1080p]
AO: [pulse] 48000Hz stereo 2ch float
VO: [gpu] 1920x1080 yuv420p
AV: 00:00:02 / 00:12:30 (0%) A-V:  0.000 Cache: 94s/23MB
Saving state.

Exiting... (Quit)

PROVIDER: animefreak
anime: anime-downloader 4.0.1
+--------+----------------------------------------------------------+--------+
|     24 | Maji de Watashi ni Koi Shinasai!                         |        |
|     23 | Mahou Shoujo Madoka Magica                               |        |
|     22 | Mahou Shoujo Site                                        |        |
|     21 | High Score Girl                                          |        |
|     20 | Peach Girl                                               |        |
|     19 | Otome Youkai Zakuro                                      |        |
|     18 | Nazo no Kanojo X                                         |        |
|     17 | Joshikousei no Mudazukai                                 |        |
|     16 | Netoge no Yome wa Onnanoko ja Nai to Omotta?             |        |
|     15 | Busou Shoujo Machiavellianism                            |        |
|     14 | Girly Air Force                                          |        |
|     13 | Mahou Shoujo Tokushusen Asuka                            |        |
|     12 | Ookami Shoujo to Kuro Ouji                               |        |
|     11 | 3D Kanojo: Real Girl                                     |        |
|     10 | Senryuu Shoujo                                           |        |
|      9 | Hajimete no Gal                                          |        |
|      8 | Sakurasou no Pet na Kanojo                               |        |
|      7 | 3D Kanojo: Real Girl 2nd Season                          |        |
|      6 | Monster Musume no Iru Nichijou                           |        |
|      5 | Domestic na Kanojo                                       |        |
|      4 | Kono Yo no Hate de Koi wo Utau Shoujo YU-NO              |        |
|      3 | Dungeon ni Deai wo Motomeru no wa Machigatteiru Darou ka |        |
|      2 | Seishun Buta Yarou wa Bunny Girl Senpai no Yume wo Minai |        |
|      1 | Aho Girl                                                 |        |
|--------+----------------------------------------------------------+--------|
|   SlNo | Title                                                    | Meta   |
+--------+----------------------------------------------------------+--------+
Enter the anime no:  [1]:
anime: Selected Aho Girl
anime: Extracting episode info from page
anime: Found anime: Aho Girl
(+) Video --vid=1 (*) (h264 1280x720 23.810fps)
(+) Audio --aid=1 --alang=jpn (*) (aac 2ch 44100Hz)
AO: [pulse] 44100Hz stereo 2ch float
VO: [gpu] 1280x720 yuv420p
AV: 00:00:01 / 00:12:30 (0%) A-V:  0.000 Cache: 43s/3MB
Saving state.

Exiting... (Quit)

PROVIDER: animeflv
anime: anime-downloader 4.0.1
+--------+----------+--------+
|      1 | Aho Girl |        |
|--------+----------+--------|
|   SlNo | Title    | Meta   |
+--------+----------+--------+
Enter the anime no:  [1]:
anime: Selected Aho Girl
anime: Extracting episode info from page
anime: Found anime: Aho Girl
anime: Quality 1080p not found. Trying 720p.
anime: Quality 720p not found. Trying 480p.
anime: Quality 480p not found. Trying 360p.
anime: Skipping episode: 1
ERROR: ('No supported host server found.  Try another site.', 'https://animeflv.net/ver/46404/aho-girl-1')

PROVIDER: anistream
anime: anime-downloader 4.0.1
+--------+----------------------+--------+
|      2 | Mahoutsukai Precure! |        |
|      1 | Aho Girl             |        |
|--------+----------------------+--------|
|   SlNo | Title                | Meta   |
+--------+----------------------+--------+
Enter the anime no:  [1]:
anime: Selected Aho Girl
anime: Extracting episode info from page
anime: Found anime: Aho Girl
(+) Video --vid=1 (*) (h264 1280x720 23.976fps)
(+) Audio --aid=1 (*) (aac 2ch 44100Hz)
AO: [pulse] 44100Hz stereo 2ch float
VO: [gpu] 1280x720 yuv420p
AV: 00:00:01 / 00:12:30 (0%) A-V:  0.000 Cache: 53s/6MB
Saving state.

Exiting... (Quit)

PROVIDER: gogoanime
anime: anime-downloader 4.0.1
+--------+----------------------+--------+
|      2 | Mahoutsukai Precure! |        |
|      1 | Aho Girl             |        |
|--------+----------------------+--------|
|   SlNo | Title                | Meta   |
+--------+----------------------+--------+
Enter the anime no:  [1]:
anime: Selected Aho Girl
anime: Extracting episode info from page
anime: Found anime: Aho Girl
(+) Video --vid=1 (*) (h264 1920x1080 23.976fps)
(+) Audio --aid=1 --alang=jpn (*) (aac 2ch 44100Hz)
AO: [pulse] 44100Hz stereo 2ch float
VO: [gpu] 1920x1080 yuv420p
AV: 00:00:00 / 00:12:30 (0%) A-V:  0.000 Cache: 0.7s/186KB
Screenshot: 'mpv-shot0001.jpg'
(Paused) AV: 00:00:07 / 00:12:30 (0%) A-V:  0.000 Cache: 15s/2MB
Saving state.

Exiting... (Quit)

PROVIDER: kissanime
anime: anime-downloader 4.0.1
ERROR: Missing Node.js runtime. Node is required and must be in the PATH (check with `node -v`). Your Node binary may be called `nodejs` rather than `node`, in which case you may need to run `apt-get install nodejs-legacy` on some Debian-based systems. (Please read the cfscrape README's Dependencies section: https://github.com/Anorov/cloudflare-scrape#dependencies.

PROVIDER: kisscartoon
anime: anime-downloader 4.0.1
ERROR: Missing Node.js runtime. Node is required and must be in the PATH (check with `node -v`). Your Node binary may be called `nodejs` rather than `node`, in which case you may need to run `apt-get install nodejs-legacy` on some Debian-based systems. (Please read the cfscrape README's Dependencies section: https://github.com/Anorov/cloudflare-scrape#dependencies.

PROVIDER: twist.moe
anime: anime-downloader 4.0.1
ERROR: [Errno 2] No such file or directory: 'node'

PROVIDER: itsaturday
anime: anime-downloader 4.0.1
+--------+---------------------------------+--------+
|      1 | Angry Little Asian Girl (2014-) |        |
|--------+---------------------------------+--------|
|   SlNo | Title                           | Meta   |
+--------+---------------------------------+--------+
Enter the anime no:  [1]: ^CAborted!

So... is this an issue with @KoroFX? Is he just not tech savy enough to install and run the script? Is it that he is a troll considering he has a discord bot on his github account (which in itself, as an account, requires some knowledge to make)? Or perhaps is just that 'anime downloader' should put front and center (default) the providers that actually work +90% of the time such as animepahe for example, or even stop calling some providers supported when they aren't really working?
Consider that on the github page... 9anime is the first site listed. Where as in my opinion the first site that actually even work properly is Gogoanime which is in 5th place. By the time a user goes to 5th place or animepahe at 6th place they will just consider the script doesn't even work. I will make a PR for this reason asap.

This really wasn't meant for the average user. Some of us find command line programs much easier and faster to use.
Making it usable for the average user is probably something far down the line, so I'm closing this issue.


Resium mouse event

Hi there,
I want to handle mouse event but I did not do it.
I used ScreenSpaceEventHandler but is not work correctly. Please suggest info.
My demo codes below ;
import React from "react";
import { KeyboardEventModifier, ScreenSpaceEventType, Cartesian3 } from "cesium";
import { Viewer, Entity, ScreenSpaceEventHandler, ScreenSpaceEvent } from "resium";
import { hot } from "react-hot-loader/root";
import memoize from "memoize-one";

class ResiumMap extends React.Component{

   constructor(){
        super();
        this.action  = this.action.bind(this);

    }
    action (label) {
        console.log("it's ok")
        console.log(label);
    }

    render(){
        return(
            <Viewer  className="cesiumContainer"
                imageryProvider={imageryProvider}
                geocoder={false}
                timeline={false}
                navigationHelpButton={false}
                homeButton={false}
                baseLayerPicker={false}
                animation={false}
            >

                <ScreenSpaceEventHandler>
                    <ScreenSpaceEvent action={this.action('Left Click')} type={ScreenSpaceEventType.MOUSE_MOVE} />
                    <ScreenSpaceEvent action={this.action('Right Click')} type={ScreenSpaceEventType.RIGHT_CLICK} />
                    <ScreenSpaceEvent action={this.action('Left Double Click')} type={ScreenSpaceEventType.LEFT_DOUBLE_CLICK} />
                    <ScreenSpaceEvent action={this.action('Shift + Right Click')} type={ScreenSpaceEventType.RIGHT_CLICK} modifier={KeyboardEventModifier.SHIFT}/>
                </ScreenSpaceEventHandler>
            </Viewer>
        )
    }
}
export default hot(ResiumMap);

Please say , this code why not run correctly.

You have a scope issue here - the Resium component doesn't know what this is.


feat: adding tool mode to LC model component

This pull request includes updates to the MessageInput class and enhancements to the LCModelComponent class to improve functionality and user experience.
Features:

tool_mode added
info for inputs updated
added toolmixin for message input DataType.

Enhancements to LCModelComponent:

src/backend/base/langflow/base/models/model.py: Added additional attributes to MessageInput, such as info and tool_mode, to provide more context and functionality for the input field.

Updates to MessageInput class:

src/backend/base/langflow/inputs/inputs.py: Modified MessageInput to inherit from ToolModeMixin, enhancing its capabilities by integrating tool mode functionality.

https://www.loom.com/share/d8fc8fd597db4fbbbc35e288afb0e3ea?sid=6ac19a43-3378-4f96-9c6b-cb5f67967471

@ogabrielluiz This was a PoC request.
ref: @carlosrcoelho @rodrigosnader
I had tested it just now. This could be used if we need LLM to perform certain stand-alone tasks.
We, even I, had a similar thought: should we have this functionality?
I am looking forward to your guidance on should we proceed with this update? (ignore the first error in demo, due to API rate limits)

PoC:
Closed until further requirement.


Support ReSharper 9

I've tried setting up a v9 project but there's some changes with the MVC support that I'm not sure how to handle.
Classes like MvcAreaReference<T> and MvcControllerReference<T> now require a version to be passed to the constructor but I'm not sure what this represents or where it should come from.
I know @citizenmatt has helped with past updates so maybe he could shed some light on these changes.

:+1:

It's the version of MVC itself and is used mostly to work with changes in MVC6. It's used:

To get correct signature for create method from an action reference - the action result type changed in MVC6, AIUI
To provide the correct base type when creating a controller from an action reference - the controller class has changed in MVC6.
To adapt view names to include display modes for MVC4+

I'm not sure how that would best be adapted for Nancy. I don't think any of these concepts (or actions) apply, so I'd be inclined to pass new Version(0, 0, 0, 0).


Update self-managed-enterprise-edition.md

Added the note to not upgrade to SMP 0.12.0 and SMP 0.13.0
Harness Developer Pull Request
Thanks for helping us make the Developer Hub better. The PR will be looked at
by the CODEOWNERS.
What Type of PR is This?

[ ] Issue
[ ] Feature
[ ] Maintenance/Chore

If tied to an Issue, list the Issue(s) here:

Issue(s)

House Keeping
Some items to keep track of. Screen shots of changes are optional but would help the maintainers review quicker.

[ ] Tested Locally
[ ] Optional Screen Shoot.

Please check the Execution Link of the Pipeline for the Website Draft URL. This is located in the Preview Step behind the Harness VPN and also is available in #hdh_alerts. E.g Website Draft URL: https://unique-id--harness-developer.netlify.app. Current Draft URL is: https://65c4765be27f703e349d05c3--harness-developer.netlify.app

Please check the Execution Link of the Pipeline for the Website Draft URL. This is located in the Preview Step behind the Harness VPN and also is available in #hdh_alerts. E.g Website Draft URL: https://unique-id--harness-developer.netlify.app. Current Draft URL is: https://65c477bb0fef273f23c759dc--harness-developer.netlify.app

Please check the Execution Link of the Pipeline for the Website Draft URL. This is located in the Preview Step behind the Harness VPN and also is available in #hdh_alerts. E.g Website Draft URL: https://unique-id--harness-developer.netlify.app. Current Draft URL is: https://65c47882a933203da87d90ad--harness-developer.netlify.app

Please check the Execution Link of the Pipeline for the Website Draft URL. This is located in the Preview Step behind the Harness VPN and also is available in #hdh_alerts. E.g Website Draft URL: https://unique-id--harness-developer.netlify.app. Current Draft URL is: https://65c47a08eb70813b975484cb--harness-developer.netlify.app


Add evaluation code for DICOM image de-identification

Is your feature request related to a problem? Please describe.
When experimenting with the DicomImageRedactorEngine, it would be great to be able to automatically evaluate the performance. Metrics such as precision and recall (with the identified PHI) could be very helpful.
Describe the solution you'd like
Add new functionality to DicomImageRedactorEngine or create a new class to host all code necessary to automate evaluation of DICOM image de-identification.
A template for the ground-truth file should also be provided.
Describe alternatives you've considered
Evaluation can be done manually, but it is tedious and not scalable.

Currently working on addressing this. Will create a PR when ready.

Need to merge in a PR to address a limitation with ImagePiiVerifyEngine before creating PR for DicomImagePiiVerifyEngine.


Add Trisolaris AURORA-NEAR dual reward pool

Vault: 0xA477cFaFEF8BEe2B306A717ba809bc97776c740C
Strategy: 0x9105181007d4A2d8894Db1fD52Ea1ddfB98C860A
Want: 0x1e0e812FBcd3EB75D8562AD6F310Ed94D258D008
PoolId: 24
API PR: https://github.com/beefyfinance/beefy-api/pull/771 (already merged)

@0xCmdrKeen Update your timestamp and also make sure the safety score entries are accurate. This is not a MCAP_MICRO


Envoy pre-compiled binaries not working on Windows Subsystem for Linux

Title: Envoy pre-compiled binaries not working on Windows Subsystem for linux
Description:

On a Windows machine, I enabled Windows Subsystem for Linux and installed Ubuntu as part of it. But when I try to run per-compiled binaries of Envoy, it crashes while trying to connect to upstream service.

Repro steps:

On a Windows machine, enable Windows Subsystem for Linux: link
Install Envoy using following steps.
https://www.getenvoy.io/platforms/envoy/ubuntu/
Download sample google example config
Run Envoy: envoy -c google_com_proxy.v2.yaml
Hit curl http://localhost:10000/

Config:

https://github.com/envoyproxy/envoy/blob/98c35eff10ad170d550fb5ecfc2c6b3637418c0c/configs/google_com_proxy.v2.yaml

FYI this is not a platform that is likely to receive much community support. I would suggest reporting this to Microsoft.

@ravgupms are you on WSL 1 or WSL 2? which version are you running? stable?

I was able to repro this in WSL 1 but not in WSL 2. The crash is due to the RELEASE_ASSERT here. I think this is because WSL doesn't implement getsockname system call correctly in WSL 1.
@ravgupms you may want to report to https://github.com/microsoft/WSL, there are several issues around about getsockname already. Or just use WSL 2.

Thanks @lizan for the info!
I have opened a ticket on WSL team.
https://github.com/microsoft/WSL/issues/4538
In the meantime, I will try to check on WSL2 but looks like I have to be on their fast insider ring to get the required build to install WSL2


Docker check fails on Windows

testcontainers doesn't work smoothly on Windows.
The check that is run at the very beginning always erroneously fails on the first test (failing the whole test run):
Docker environment should have more than 2GB free disk space
java.lang.AssertionError: Docker environment should have more than 2GB free disk space

The workaround is easy, jut put testcontainers.properties in resources with this:
checks.disable = true

But this is still a bug.
CC @rpliva

But do you have more than 2Gb allocated to your Docker VM?

Sorry, if I haven't explained it as clearly: yes, there is definitely more than 2 GB available

@sideeffffect could you please post the output of docker run -it --rm alpine:3.6 df -h?

Docker output:
C:\Projects>docker run -it --rm alpine:3.6 df -h
Unable to find image 'alpine:3.6' locally
3.6: Pulling from library/alpine
5a3ea8efae5d: Pull complete
Digest: sha256:66790a2b79e1ea3e1dabac43990c54aca5d1ddf268d9a5a0285e4167c8b24475
Status: Downloaded newer image for alpine:3.6
Filesystem                Size      Used Available Use% Mounted on
overlay                  14.6G     13.4G    495.7M  97% /
tmpfs                    64.0M         0     64.0M   0% /dev
tmpfs                     1.5G         0      1.5G   0% /sys/fs/cgroup
/dev/sda1                14.6G     13.4G    495.7M  97% /etc/resolv.conf
/dev/sda1                14.6G     13.4G    495.7M  97% /etc/hostname
/dev/sda1                14.6G     13.4G    495.7M  97% /etc/hosts
shm                      64.0M         0     64.0M   0% /dev/shm
tmpfs                     1.5G         0      1.5G   0% /proc/acpi
tmpfs                    64.0M         0     64.0M   0% /proc/kcore
tmpfs                    64.0M         0     64.0M   0% /proc/keys
tmpfs                    64.0M         0     64.0M   0% /proc/timer_list
tmpfs                    64.0M         0     64.0M   0% /proc/sched_debug
tmpfs                     1.5G         0      1.5G   0% /sys/firmware

C:\Projects>

Filesystem                Size      Used Available Use% Mounted on
overlay                  14.6G     13.4G    495.7M  97% /

Apparently you don't have 2Gb of space in Docker's VM. Please either increase it or remove unused images or something else.
if the issue remains after the cleanup, you can reopen this issue and we will continue the investigation.

and Docker Desktop settings

It's not a problem of the settings (0 B used display might be a bug in the Docker UI here).
You can clearly see overlay                  14.6G     13.4G    495.7M  97% / in your output above.
You can cleanup by e.g. running docker system prune.

Yes, docker system prune helped and now I have more than 11GB free space and everything work.

You can cleanup by e.g. running docker system prune.

For future visitors. Be careful with docker system prune. Make sure you know what you're doing.
https://docs.docker.com/v17.12/engine/reference/commandline/system_prune


Crashes when closed

Trying to close the script often times causes the program to crash or hang.
I believe this is due to the serial thread not receiving the command to close and causing a hang-up.

Fixed by pull request

This is still broken in Mac OS.... Opening to investigate.


Tech Stack Update ( LOGO add )

I will like to add tech stack logo used in our project this will make our project attractive !! Will start to work on this issue as soon as i get assigned !!

We don't need that as of now.


InlayHints not working on neovim

Description
The source code indicates that omnisharp-roslyn already supports InlayHint, but testing from neovim reports that omnisharp does not support textDocument/inlayHint
How to reproduce
Start omnisharp using the following command
omnisharp -z --hostPID {neovimPID} DotNet:enablePackageRestore=false --encoding utf-8 --languageserver \
    FormattingOptions:EnableEditorConfigSupport=true FormattingOptions:OrganizeImports=true \
    MsBuild:LoadProjectsOnDemand=true RoslynExtensionsOptions:EnableAnalyzersSupport=true \
    RoslynExtensionsOptions:EnableImportCompletion=true Sdk:IncludePrereleases=true \
    RoslynExtensionsOptions:InlayHintsOptions:EnableForParameters=true \
    RoslynExtensionsOptions:InlayHintsOptions:ForLiteralParameters=true \
    RoslynExtensionsOptions:InlayHintsOptions:ForIndexerParameters=true \
    RoslynExtensionsOptions:InlayHintsOptions:ForObjectCreationParameters=true \
    RoslynExtensionsOptions:InlayHintsOptions:ForOtherParameters=true \
    RoslynExtensionsOptions:InlayHintsOptions:SuppressForParametersThatDifferOnlyBySuffix=false \
    RoslynExtensionsOptions:InlayHintsOptions:SuppressForParametersThatMatchMethodIntent=false \
    RoslynExtensionsOptions:InlayHintsOptions:SuppressForParametersThatMatchArgumentName=false \
    RoslynExtensionsOptions:InlayHintsOptions:EnableForTypes=true \
    RoslynExtensionsOptions:InlayHintsOptions:ForImplicitVariableTypes=true \
    RoslynExtensionsOptions:InlayHintsOptions:ForLambdaParameterTypes=true \
    RoslynExtensionsOptions:InlayHintsOptions:ForImplicitObjectCreation=true

I use a fork of nvim-lspconfig that adds the necessary command-line parameters to enable inlayHint
LSP Log (original)
[WARN][2023-07-12 18:55:36] .../lua/vim/lsp.lua:100	"method textDocument/inlayHint is not supported by any of the servers registered for the current buffer"
[WARN][2023-07-12 18:55:36] .../lua/vim/lsp.lua:100	"method textDocument/inlayHint is not supported by any of the servers registered for the current buffer"

LSP Log (pretending that the server supports inlayHint, so that client can at least send the request)
[DEBUG][2023-07-12 18:59:54] .../vim/lsp/rpc.lua:259	"rpc.send"	{  id = 3,  jsonrpc = "2.0",  method = "textDocument/inlayHint",  params = {    range = {      ["end"] = {        character = 0,        line = 43      },      start = {        character = 0,        line = 12      }    },    textDocument = {      uri = "file:///Users/*.cs"    }  }}
[DEBUG][2023-07-12 18:59:54] .../lua/vim/lsp.lua:1489	"LSP[omnisharp]"	"client.request"	1	"textDocument/inlayHint"	{  range = {    ["end"] = {      character = 0,      line = 106    },    start = {      character = 0,      line = 0    }  },  textDocument = {    uri = "file:///..*.cs"  }}	<function 1>	14
[DEBUG][2023-07-12 18:59:54] .../vim/lsp/rpc.lua:259	"rpc.send"	{  id = 4,  jsonrpc = "2.0",  method = "textDocument/inlayHint",  params = {    range = {      ["end"] = {        character = 0,        line = 106      },      start = {        character = 0,        line = 0      }    },    textDocument = {      uri = "file:///....*.cs"    }  }}
[DEBUG][2023-07-12 18:59:54] .../vim/lsp/rpc.lua:362	"rpc.receive"	{  error = {    code = -32601,    message = "Method not found - textDocument/inlayHint"  },  id = 3,  jsonrpc = "2.0"}
[DEBUG][2023-07-12 18:59:54] .../vim/lsp/rpc.lua:362	"rpc.receive"	{  error = {    code = -32601,    message = "Method not found - textDocument/inlayHint"  },  id = 4,  jsonrpc = "2.0"}

System Details
OS: MacOS Ventura
Neovim: NVIM v0.10.0-dev-4683+g06694203e-Homebrew
Omnisharp: 1.39.7

I have the same problem with neovim on Windows

I second this, neovim is not triggering any inlay hints regardless

To support inlay hints we will need a release of https://github.com/OmniSharp/csharp-language-server-protocol with updates from the 3.17 spec.

I tried the new version of omnisharp (1.39.9) in Neovim, but whenever my client tries to get inlay hints I get the following error (or similar):
omnisharp: -32603: Internal Error - System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. (Parameter 'index')
   at Microsoft.CodeAnalysis.Text.SourceText.LineInfo.get_Item(Int32 index)
   at OmniSharp.Extensions.TextExtensions.GetPositionFromLineAndOffset(SourceText text, Int32 lineNumber, Int32 offset) in /home/vsts/work/1/s/src/OmniSharp.Roslyn/Extensions/TextExtensions.cs:line 28
   at OmniSharp.Extensions.TextExtensions.GetSpanFromRange(SourceText text, Range range) in /home/vsts/work/1/s/src/OmniSharp.Roslyn/Extensions/TextExtensions.cs:line 55
   at OmniSharp.Roslyn.CSharp.Services.InlayHints.InlayHintService.Handle(InlayHintRequest request) in /home/vsts/work/1/s/src/OmniSharp.Roslyn.CSharp/Services/InlayHints/InlayHintService.cs:line 60
   at OmniSharp.LanguageServerProtocol.Handlers.OmniSharpInlayHintHandler.Handle(InlayHintParams request, CancellationToken cancellationToken) in /home/vsts/work/1/s/src/OmniSharp.LanguageServerProtocol/Handle
rs/OmniSharpInlayHintHandler.cs:line 56
   at OmniSharp.Extensions.LanguageServer.Server.Pipelines.SemanticTokensDeltaPipeline`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
   at OmniSharp.Extensions.LanguageServer.Server.Pipelines.ResolveCommandPipeline`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
   at MediatR.Pipeline.RequestPreProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
   at MediatR.Pipeline.RequestPostProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
   at MediatR.Pipeline.RequestExceptionProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
   at MediatR.Pipeline.RequestExceptionProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
   at MediatR.Pipeline.RequestExceptionActionProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
   at MediatR.Pipeline.RequestExceptionActionProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
   at OmniSharp.Extensions.JsonRpc.RequestRouterBase`1.<RouteRequest>g__InnerRoute|7_0(IServiceScopeFactory serviceScopeFactory, Request request, TDescriptor descriptor, Object params, CancellationToken token,
 ILogger logger)
   at OmniSharp.Extensions.JsonRpc.RequestRouterBase`1.RouteRequest(IRequestDescriptor`1 descriptors, Request request, CancellationToken token)
   at OmniSharp.Extensions.JsonRpc.DefaultRequestInvoker.<>c__DisplayClass10_0.<<RouteRequest>b__5>d.MoveNext()

This is my omnisharp.json config:
{
  "RoslynExtensionsOptions": {
    "inlayHintsOptions": {
        "enableForParameters": true,
        "forLiteralParameters": true,
        "forIndexerParameters": true,
        "forObjectCreationParameters": true,
        "forOtherParameters": true,
        "suppressForParametersThatDifferOnlyBySuffix": false,
        "suppressForParametersThatMatchMethodIntent": false,
        "suppressForParametersThatMatchArgumentName": false,
        "enableForTypes": true,
        "forImplicitVariableTypes": true,
        "forLambdaParameterTypes": true,
        "forImplicitObjectCreation": true
    }
  }
}
Here is an excerpt from the LSP interaction logs:
`OmniSharp.Extensions.JsonRpc.DefaultRequestInvoker: Failed to handle request textDocument/inlayHint 4 - System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. (Parameter 'index')\n   at Microsoft.CodeAnalysis.Text.SourceText.LineInfo.get_Item(Int32 index)\n   at OmniSharp.Extensions.TextExtensions.GetPositionFromLineAndOffset(SourceText text, Int32 lineNumber, Int32 offset) in /home/vsts/work/1/s/src/OmniSharp.Roslyn/Extensions/TextExtensions.cs:line 28\n   at OmniSharp.Extensions.TextExtensions.GetSpanFromRange(SourceText text, Range range) in /home/vsts/work/1/s/src/OmniSharp.Roslyn/Extensions/TextExtensions.cs:line 55\n   at OmniSharp.Roslyn.CSharp.Services.InlayHints.InlayHintService.Handle(InlayHintRequest request) in /home/vsts/work/1/s/src/OmniSharp.Roslyn.CSharp/Services/InlayHints/InlayHintService.cs:line 60\n   at OmniSharp.LanguageServerProtocol.Handlers.OmniSharpInlayHintHandler.Handle(InlayHintParams request, CancellationToken cancellationToken) in /home/vsts/work/1/s/src/OmniSharp.LanguageServerProtocol/Handlers/OmniSharpInlayHintHandler.cs:line 56\n   at OmniSharp.Extensions.LanguageServer.Server.Pipelines.SemanticTokensDeltaPipeline`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)\n   at OmniSharp.Extensions.LanguageServer.Server.Pipelines.ResolveCommandPipeline`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)\n   at MediatR.Pipeline.RequestPreProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)\n   at MediatR.Pipeline.RequestPostProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)\n   at MediatR.Pipeline.RequestExceptionProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)\n   at MediatR.Pipeline.RequestExceptionProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)\n   at MediatR.Pipeline.RequestExceptionActionProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)\n   at MediatR.Pipeline.RequestExceptionActionProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)\n   at OmniSharp.Extensions.JsonRpc.RequestRouterBase`1.<RouteRequest>g__InnerRoute|7_0(IServiceScopeFactory serviceScopeFactory, Request request, TDescriptor descriptor, Object params, CancellationToken token, ILogger logger)\n   at OmniSharp.Extensions.JsonRpc.RequestRouterBase`1.RouteRequest(IRequestDescriptor`1 descriptors, Request request, CancellationToken token)\n   at OmniSharp.Extensions.JsonRpc.DefaultRequestInvoker.<>c__DisplayClass10_0.<<RouteRequest>b__5>d.MoveNext() | Method='textDocument/inlayHint' RequestId='4'"
` (this is a single line, not sure how to format here)
I lack the knowledge to debug this issue effectively, unfortunately. Any ideas as to what might be wrong? Is the problem my configuration, or is the problem on `omnisharp`'s side?

I will verify this fix later today. Thanks @JoeRobich

@bmvi-kinver would you be able to share more about your setup if you have this working? I snooped on your profile but didn't find any dotfiles there :)
I'm running neovim nightly (v0.10.0-dev-6823fdb) with Omnisharp v1.39.10 and my neovim native inlay hints are not working. The LSP server does not seem to report supporting inlay hints (ciient.server_capabilities.inlayHintProvider == false) and when I enable it for a buffer manually (vim.lsp.inlay_hint(0, true)) I get this:
omnisharp: -32603: Internal Error - System.NullReferenceException: Object reference not set to an instance of an object.
   at OmniSharp.LanguageServerProtocol.Helpers.ToTextEdits(LinePositionSpanTextChange[] textChanges)+MoveNext() in /Users/runner/work/1/s/src/OmniSharp.LanguageServerProtocol/Helpers.cs:line 246
   at System.Collections.Generic.LargeArrayBuilder`1.AddRange(IEnumerable`1 items)
   at System.Collections.Generic.EnumerableHelpers.ToArray[T](IEnumerable`1 source)
   at OmniSharp.Extensions.LanguageServer.Protocol.Models.ContainerBase`1..ctor(IEnumerable`1 items)
   at OmniSharp.Extensions.LanguageServer.Protocol.Models.Container`1..ctor(IEnumerable`1 items)
   at OmniSharp.LanguageServerProtocol.Handlers.OmniSharpInlayHintHandler.ToLSPInlayHint(InlayHint hint) in /Users/runner/work/1/s/src/OmniSharp.LanguageServerProtocol/Handlers/OmniSharpInlayHintHandler.cs:line 77
   at System.Linq.Enumerable.SelectListIterator`2.ToArray()
   at OmniSharp.Extensions.LanguageServer.Protocol.Models.ContainerBase`1..ctor(IEnumerable`1 items)
   at OmniSharp.Extensions.LanguageServer.Protocol.Models.InlayHintContainer..ctor(IEnumerable`1 items)
   at OmniSharp.LanguageServerProtocol.Handlers.OmniSharpInlayHintHandler.Handle(InlayHintParams request, CancellationToken cancellationToken) in /Users/runner/work/1/s/src/OmniSharp.LanguageServerProtocol/Handlers/OmniSharpInlayHintHandler.cs:line 58
   at OmniSharp.Extensions.LanguageServer.Server.Pipelines.SemanticTokensDeltaPipeline`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
   at OmniSharp.Extensions.LanguageServer.Server.Pipelines.ResolveCommandPipeline`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
   at MediatR.Pipeline.RequestPreProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
   at MediatR.Pipeline.RequestPostProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
   at MediatR.Pipeline.RequestExceptionProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
   at MediatR.Pipeline.RequestExceptionProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
   at MediatR.Pipeline.RequestExceptionActionProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
   at MediatR.Pipeline.RequestExceptionActionProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
   at OmniSharp.Extensions.JsonRpc.RequestRouterBase`1.<RouteRequest>g__InnerRoute|7_0(IServiceScopeFactory serviceScopeFactory, Request request, TDescriptor descriptor, Object params, CancellationToken token, ILogger logger)
   at OmniSharp.Extensions.JsonRpc.RequestRouterBase`1.RouteRequest(IRequestDescriptor`1 descriptors, Request request, CancellationToken token)
   at OmniSharp.Extensions.JsonRpc.DefaultRequestInvoker.<>c__DisplayClass10_0.<<RouteRequest>b__5>d.MoveNext()

@tanordheim I can certainly share my config, but it seems that I was too quick to pull the trigger as I'm now experiencing the same problem as you are -- but only for particular files, while for other files it appears to be working properly. In my own project, it looks like inlay hints don't work for any files that has using Pulumi.SomeIdentifier statements.

Inlay hints work fine for me, although both textDocument_inlayHint AND textDocument_hover are incorrectly reported. As long as I hardcode them as enabled for omnisharp instead of checking client.supportsMethod, it works.

I get that same object reference error in both Helix, and VSCode (c# extension installed, OmniSharp enabled, and LSP drivers enabled)

In the end I decided to try to build the repo locally and try to find the bug, the problem will happen always when there is a lambda as a parameter of a function (so very common if you use LINQ as an example)
I've successfully made a change to fix the problem! I opened a PR, hopefully it gets merged if I did not miss any detail while debugging the code, in the meanwhile you can build my branch with build.ps1 and set omnisharp cmd like this somewhere in your config (edit options as needed to you)
cmd = {
  "C:\\phat\\to\\repo\\omnisharp-roslyn\\artifacts\\publish\\OmniSharp.Stdio.Driver\\win7-x64\\net6.0\\OmniSharp.exe",
  "-z",
  "--hostPID",
  tostring(vim.fn.getpid()),
  "DotNet:enablePackageRestore=false",
  "--encoding",
  "utf-8",
  "--languageserver",
  "FormattingOptions:EnableEditorConfigSupport=true",
  "FormattingOptions:OrganizeImports=true",
  "RoslynExtensionsOptions:EnableAnalyzersSupport=true",
  "RoslynExtensionsOptions:EnableImportCompletion=true",
  "Sdk:IncludePrereleases=true",
},

just update your nvim to 0.10 and add omnisharp.json file in your project directory with this
{   "RoslynExtensionsOptions": {     "inlayHintsOptions": {         "enableForParameters": true,         "forLiteralParameters": true,         "forIndexerParameters": true,         "forObjectCreationParameters": true,         "forOtherParameters": true,         "suppressForParametersThatDifferOnlyBySuffix": false,         "suppressForParametersThatMatchMethodIntent": false,         "suppressForParametersThatMatchArgumentName": false,         "enableForTypes": true,         "forImplicitVariableTypes": true,         "forLambdaParameterTypes": true,         "forImplicitObjectCreation": true     }   } }
and then in nvim run :lua vim.lsp.inlay_hint.enable(true)
you can set keymap to toggle inlay hint with
lua vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled())


incorrect conversion of some bibtex types?

Hi there,
I'm trying out the demo site and if I input the following into the BibTex box:
@artwork{ArtTest,
  author = {Test},
  year = {1800},
  title = {My Artwork},
}

or
@misc{Test,
  author = {Test},
  year = {1800},
  title = {My Artwork},
}

When "bibtex" or "bib.txt" is selected as the output type, I see that both are converted to the @book type. Is this expected behaviour? How can I preserve the type? Either this is an issue with the library, or something misconfigured about the demo.

The demo might run an outdated version, I will check that tomorrow. However, CSL 1.0.1 (the format Citation.js uses internally) does not have a generic document type to represent @artwork or @misc. This changes in 1.0.2 but that's not completely released yet, or supported by downstream projects. For that reason, "book" has generally been recommended as default type (I think). However there might be types that are better fallbacks for specific types like @artwork>

For @artwork I believe it's meant to be functionally equivalent to @misc. I'm not quite sure what defines that, but I think I remember seeing it in the biblatex manual somewhere.
I tried this out on citation-js 0.5.1 earlier today just to be sure, and I see the same behaviour as you mentioned.
I'd recommend support for misc at a minimum, if something like this is in the pipeline, because it's the most common suggestion I see for anything that's atypical.

Yes, the biblatex manual lists @artwork under Non-standard Types (2.1.3), adding that they do not have their own drivers, and use the one of @misc instead.

I'd recommend support for misc at a minimum, if something like this is in the pipeline, because it's the most common suggestion I see for anything that's atypical.

It's more or less in the pipeline, but I either have to wait on CSL 1.0.2 to release, or replace CSL 1.0.1 with something else which is going to take time, both planning and actually carrying it out. If you happen to have any recommendations of general-purpose but relatively comprehensive bibliographical ontologies, I would be happy to hear about them (#127).

Fixed in 6c68aff80d3e04e132c722ef508d0a45fad40a29