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

Repro for multiple declaration warning #35

Closed
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
Empty file modified run.sh
100644 → 100755
Empty file.
37 changes: 33 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,33 @@
/**
* Some code reproducing a bug.
*/
export const bug = 123;
export interface TemplatedTypeBase {
/**
* Doc here
*/
prop?: string[];
}

export interface One extends TemplatedTypeBase {}

export interface Two extends TemplatedTypeBase {}

export type Type = One | Two;

// errors
export function isTemplateInstance(
type: Type
): type is Type & { prop: string[] } {
return true;
}

// also error
export function isTemplateInstance2(
type: Type
): type is Type & Required<TemplatedTypeBase> {
return true;
}

// this works
export function isTemplateInstance3(
type: Type
): type is Type & TemplatedTypeBase {
return true;
}
9 changes: 5 additions & 4 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"compilerOptions": {
"strict": true
},
"include": ["src"]
"compilerOptions": {
"strict": true,
"lib": ["es2019"]
},
"include": ["src"]
}
Loading