Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(fast_check): emit named type in mapped types #499

Merged
merged 3 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 15 additions & 14 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ harness = false
anyhow = "1.0.43"
async-trait = "0.1.68"
data-url = "0.3.0"
deno_ast = { version = "0.39.0", features = ["dep_analysis", "emit"] }
deno_ast = { version = "0.39.2", features = ["dep_analysis", "emit"] }
deno_semver = "0.5.4"
deno_unsync = { version = "0.3.2", optional = true }
encoding_rs = "0.8.33"
Expand Down
9 changes: 7 additions & 2 deletions tests/specs/ecosystem/codehz/mutable_element/0_2_0.test
Original file line number Diff line number Diff line change
Expand Up @@ -223,14 +223,19 @@ TS2304 [ERROR]: Cannot find name 'Node'.
at file://<tmpdir>/src/types.ts:3:68

TS2304 [ERROR]: Cannot find name 'CSSStyleDeclaration'.
[K in keyof CSSStyleDeclaration]?: string | boolean | null;
[K in keyof CSSStyleDeclaration as [K, CSSStyleDeclaration[K]] extends [string, string] ? K : never]?: string | boolean | null;
~~~~~~~~~~~~~~~~~~~
at file://<tmpdir>/src/types.ts:33:15

TS2304 [ERROR]: Cannot find name 'CSSStyleDeclaration'.
[K in keyof CSSStyleDeclaration as [K, CSSStyleDeclaration[K]] extends [string, string] ? K : never]?: string | boolean | null;
~~~~~~~~~~~~~~~~~~~
at file://<tmpdir>/src/types.ts:33:42

TS2304 [ERROR]: Cannot find name 'IdleDeadline'.
export function idle(): Reactor<IdleDeadline> {
~~~~~~~~~~~~
at file://<tmpdir>/src/utils.ts:55:33

Found 45 errors.
Found 46 errors.

9 changes: 7 additions & 2 deletions tests/specs/ecosystem/codehz/mutable_element/0_2_1.test
Original file line number Diff line number Diff line change
Expand Up @@ -223,14 +223,19 @@ TS2304 [ERROR]: Cannot find name 'Node'.
at file://<tmpdir>/src/types.ts:3:68

TS2304 [ERROR]: Cannot find name 'CSSStyleDeclaration'.
[K in keyof CSSStyleDeclaration]?: string | boolean | null;
[K in keyof CSSStyleDeclaration as [K, CSSStyleDeclaration[K]] extends [string, string] ? K : never]?: string | boolean | null;
~~~~~~~~~~~~~~~~~~~
at file://<tmpdir>/src/types.ts:33:15

TS2304 [ERROR]: Cannot find name 'CSSStyleDeclaration'.
[K in keyof CSSStyleDeclaration as [K, CSSStyleDeclaration[K]] extends [string, string] ? K : never]?: string | boolean | null;
~~~~~~~~~~~~~~~~~~~
at file://<tmpdir>/src/types.ts:33:42

TS2304 [ERROR]: Cannot find name 'IdleDeadline'.
export function idle(): Reactor<IdleDeadline> {
~~~~~~~~~~~~
at file://<tmpdir>/src/utils.ts:55:33

Found 45 errors.
Found 46 errors.

9 changes: 7 additions & 2 deletions tests/specs/ecosystem/codehz/mutable_element/0_2_2.test
Original file line number Diff line number Diff line change
Expand Up @@ -228,14 +228,19 @@ TS2304 [ERROR]: Cannot find name 'Node'.
at file://<tmpdir>/src/types.ts:3:68

TS2304 [ERROR]: Cannot find name 'CSSStyleDeclaration'.
[K in keyof CSSStyleDeclaration]?: string | boolean | null;
[K in keyof CSSStyleDeclaration as [K, CSSStyleDeclaration[K]] extends [string, string] ? K : never]?: string | boolean | null;
~~~~~~~~~~~~~~~~~~~
at file://<tmpdir>/src/types.ts:33:15

TS2304 [ERROR]: Cannot find name 'CSSStyleDeclaration'.
[K in keyof CSSStyleDeclaration as [K, CSSStyleDeclaration[K]] extends [string, string] ? K : never]?: string | boolean | null;
~~~~~~~~~~~~~~~~~~~
at file://<tmpdir>/src/types.ts:33:42

TS2304 [ERROR]: Cannot find name 'IdleDeadline'.
export function idle(): Reactor<IdleDeadline> {
~~~~~~~~~~~~
at file://<tmpdir>/src/utils.ts:55:33

Found 46 errors.
Found 47 errors.

2 changes: 1 addition & 1 deletion tests/specs/ecosystem/happy_js/happy_opfs/1_0_0.test
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ happy-js/happy-opfs/1.0.0

-- stderr --
error: npm package '@jsr/happy-js__happy-rusty' does not exist.
at file://<tmpdir>/src/fs/opfs_core.ts:1:29
at file://<tmpdir>/src/fs/opfs_ext.ts:1:29

2 changes: 1 addition & 1 deletion tests/specs/ecosystem/stump/adapter_filesystem/0_0_1.test
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ stump/adapter-filesystem/0.0.1

-- stderr --
error: npm package '@jsr/stump__core' does not exist.
at file://<tmpdir>/src/drivers/bun/index.ts:1:36
at file://<tmpdir>/src/base.ts:1:62

6 changes: 1 addition & 5 deletions tests/specs/ecosystem/ydcjeff/ruta/0_0_1.test
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,5 @@ TS1170 [ERROR]: A computed property name in a type literal must refer to an expr
~~~~~~~~~~~~~~~~
at file://<tmpdir>/src/ruta_core.ts:91:3

TS2322 [ERROR]: Type 'TChildren[number]' is not assignable to type 'string | number | symbol'.
Type 'RouteOptions<string, Record<string, never>, Record<string, never>, {}>' is not assignable to type 'string | number | symbol'.
at file://<tmpdir>/src/ruta_core.ts:128:11

Found 10 errors.
Found 9 errors.

146 changes: 146 additions & 0 deletions tests/specs/graph/fast_check/mapped_type.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
# https://jsr.io/@scope/a/meta.json
{"versions": { "1.0.0": {} } }

# https://jsr.io/@scope/a/1.0.0_meta.json
{ "exports": { ".": "./mod.ts" } }

# https://jsr.io/@scope/a/1.0.0/mod.ts
export type NoTypeAnn = {
[value: string];
};
type Private1 = string;
type Private2 = number;
export type MappedTypeWithNamedType = {
[K in T as U & Private1]: Private2;
};
export type Partial<T> = {
[P in keyof T]?: T[P];
};
export type OptionalPlus<T> = {
[P in keyof T]+?: T[P];
};
export type OptionalMinus<T> = {
[P in keyof T]-?: T[P];
};
export type Flags<T> = {
[P in keyof T]: boolean;
};
export type ReadOnly<T> = {
readonly [P in keyof T]: T[P];
};
export type ReadOnlyPlus<T> = {
+readonly [P in keyof T]: T[P];
};
export type ReadOnlyMinus<T> = {
-readonly [P in keyof T]: T[P];
};

# mod.ts
import 'jsr:@scope/a'

# output
{
"roots": [
"file:///mod.ts"
],
"modules": [
{
"kind": "esm",
"dependencies": [
{
"specifier": "jsr:@scope/a",
"code": {
"specifier": "jsr:@scope/a",
"span": {
"start": {
"line": 0,
"character": 7
},
"end": {
"line": 0,
"character": 21
}
}
}
}
],
"size": 22,
"mediaType": "TypeScript",
"specifier": "file:///mod.ts"
},
{
"kind": "esm",
"size": 631,
"mediaType": "TypeScript",
"specifier": "https://jsr.io/@scope/a/1.0.0/mod.ts"
}
],
"redirects": {
"jsr:@scope/a": "https://jsr.io/@scope/a/1.0.0/mod.ts"
},
"packages": {
"@scope/a": "@scope/[email protected]"
}
}

Fast check https://jsr.io/@scope/a/1.0.0/mod.ts:
{}
export type NoTypeAnn = {
[value: string];
};
type Private1 = string;
type Private2 = number;
export type MappedTypeWithNamedType = {
[K in T as U & Private1]: Private2;
};
export type Partial<T> = {
[P in keyof T]?: T[P];
};
export type OptionalPlus<T> = {
[P in keyof T]+?: T[P];
};
export type OptionalMinus<T> = {
[P in keyof T]-?: T[P];
};
export type Flags<T> = {
[P in keyof T]: boolean;
};
export type ReadOnly<T> = {
readonly [P in keyof T]: T[P];
};
export type ReadOnlyPlus<T> = {
+readonly [P in keyof T]: T[P];
};
export type ReadOnlyMinus<T> = {
-readonly [P in keyof T]: T[P];
};
--- DTS ---
export type NoTypeAnn = {
[value: string];
};
type Private1 = string;
type Private2 = number;
export type MappedTypeWithNamedType = {
[K in T as U & Private1]: Private2;
};
export type Partial<T> = {
[P in keyof T]?: T[P];
};
export type OptionalPlus<T> = {
[P in keyof T]+?: T[P];
};
export type OptionalMinus<T> = {
[P in keyof T]-?: T[P];
};
export type Flags<T> = {
[P in keyof T]: boolean;
};
export type ReadOnly<T> = {
readonly [P in keyof T]: T[P];
};
export type ReadOnlyPlus<T> = {
+readonly [P in keyof T]: T[P];
};
export type ReadOnlyMinus<T> = {
-readonly [P in keyof T]: T[P];
};