HyperlinkText and Typescript usage

I am developing a SPfx component using React Typescript and needs to use HyperlinkText.

How to import that file so it can be used while defining template?

We generally suggest downloading extensions and storing them locally so you can make your own changes and not worry about any breaking changes we might make to them. Once downloaded, you can import it like any other file.

You may also be interested in using the extensionsTS/HyperLinkText.ts, the Typescript version of the file.

There’s an example Angular project (not React, but it also uses Typescript) which imports an extension here.

I am using HyperLinkText.ts file only. That file contains a function defined with “HyperlinkText” as key and uses DefineBuilder static function.

The sample you referred in angular uses the GuidedDraggingTool which is exported class and hence possible to import. I am able to do same in React also.

But in case of HyperLinkText - how that key used by DefineBuilder static function will be available in other ts file ?? How to export & import same in other ts file ??

In cases like that, I think you can just import the file itself rather than an exported member from within it. I’m not sure whether you’d have to use the js version in this case.

import './HyperlinkText.ts'