def file for object export and types

前端 未结 2 1401
花落未央
花落未央 2021-01-20 10:04

Alright, so we have a Node module string-similarity who exports two functions like this (see: https://github.com/aceakash/string-similarity/blob/master/compare-

2条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-20 10:58

    To access your methods under a common parent (e.g. similarity), you need to import them under the similarity alias:

    import * as similarity from "string-similarity"; 
    
    similarity.compareTwoStrings("potato", "tomato");
    

提交回复
热议问题