Skip to content

esModuleInterop: true with class static method #45133

@bluelovers

Description

@bluelovers

Bug Report

🔎 Search Terms

class static import

🕗 Version & Regression Information

  • This is a crash
  • This changed between versions ______ and _______
  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about _________
  • I was unable to test this on prior versions because _______

⏯ Playground Link

https://www.typescriptlang.org/play?module=1#code/JYWwDg9gTgLgBAYQJIBEA0cDedgGdkpwC+cAZlBCHAOQDGwAJrtQNwCwAUJwKYAeksMgFcAdrRjAIIuGACGMABYAVCAkYAKegwBccXDCjARAczgAfRKgCUu-YZOdMnAJDBScdQQB0eApsZWVi5OHM7OUNwwQlDSWl4wEADKBkbG6kGhRJwuEVExcHERYAA2srTc6gD0AHoAOpXAYADaIqQAurj1lRjU1BlZXBx8AvCkouKS0nKKKmoMAEz+OnopJuaWKDYr9saOLm4evqhLgcEu4ZHRsYzxSatpGc4DOZf5hdwlZRU19Y0t7Z1Kt0aH1OM8ONNlKoNL0MpDZoxFrDOEA

💻 Code

import CID, { isCID } from 'cids';

export function pathToCid(cid: string | CID): string
{
	if (CID.isCID(cid))
	{
		return cid.toString()
	}

	return cid.replace(/^\/ip[nf]s\//, '')
}

export function pathToCid2(cid: string | CID): string
{
	if (isCID(cid))
	{
		return cid.toString()
	}

	return cid.replace(/^\/ip[nf]s\//, '')
}

pathToCid('')
pathToCid2('')

🙁 Actual behavior

TypeError: (0 , cids_1.isCID) is not a function

🙂 Expected behavior

  • no error on output js file
  • or show typescript error for warn this

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptDomain: JS EmitThe issue relates to the emission of JavaScriptRescheduledThis issue was previously scheduled to an earlier milestone

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions