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

Inconsistent tripple-slash directive in sub-directory #56930

Closed
icholy opened this issue Jan 2, 2024 · 4 comments
Closed

Inconsistent tripple-slash directive in sub-directory #56930

icholy opened this issue Jan 2, 2024 · 4 comments
Labels
Duplicate An existing issue was already created

Comments

@icholy
Copy link

icholy commented Jan 2, 2024

πŸ”Ž Search Terms

tripple-slash directives references

πŸ•— Version & Regression Information

v4.x did not emit these directives at all.

⏯ Playground Link

https://github.com/icholy/tsc-tripple-slash-bug

πŸ’» Code

  • src/types/fs.ts
declare module 'fs' {}
  • src/a/x.ts
import * as fs from 'fs';

export { fs };
  • src/a/b/x.ts
import * as fs from 'fs';

export { fs };

πŸ™ Actual behavior

Emitted files:

  • lib/a/x.d.ts
/// <reference path="../types/fs.d.ts" />
/// <reference types="node/fs" />
import * as fs from 'fs';
export { fs };
  • lib/a/b/x.d.ts (using types instead of path).
/// <reference types="lib/types/fs" />
/// <reference types="node/fs" />
import * as fs from 'fs';
export { fs };

πŸ™‚ Expected behavior

Emitted files:

  • lib/a/x.d.ts
/// <reference path="../types/fs.d.ts" />
/// <reference types="node/fs" />
import * as fs from 'fs';
export { fs };
  • lib/a/b/x.d.ts
/// <reference types="../../types/fs" />
/// <reference types="node/fs" />
import * as fs from 'fs';
export { fs };

Additional information about the issue

This seems to be related to module resolution.

@fatcerberus
Copy link

Looks like the same issue as #56571

@RyanCavanaugh RyanCavanaugh added the Duplicate An existing issue was already created label Jan 2, 2024
@icholy
Copy link
Author

icholy commented Jan 2, 2024

@fatcerberus that does look like the same issue. But I'm not clear on why lib/a/x/d.ts outputs a path="..." directive while lib/a/b/x.d.ts outputs a types="..." directive?

@icholy icholy changed the title Incorrect tripple-slash directive in sub-directory Inconsistent tripple-slash directive in sub-directory Jan 2, 2024
@typescript-bot
Copy link
Collaborator

This issue has been marked as "Duplicate" and has seen no recent activity. It has been automatically closed for house-keeping purposes.

@typescript-bot typescript-bot closed this as not planned Won't fix, can't repro, duplicate, stale Jan 5, 2024
@icholy
Copy link
Author

icholy commented Jan 5, 2024

@RyanCavanaugh do you have any insight about why the two files contain different variations of the directive?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

4 participants