首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >不建议使用fp-ts -管道。

不建议使用fp-ts -管道。
EN

Stack Overflow用户
提问于 2021-05-11 03:08:29
回答 1查看 1.3K关注 0票数 3

我在我的类型记录/反应项目中使用了"fp-ts": "^2.10.5",并且我收到了“管道”已经被废弃的警告。下面的代码来自于关于如何使用fp进行错误处理和验证的教程:

代码语言:javascript
复制
import { Either, left, right } from 'fp-ts/lib/Either'
import { chain } from 'fp-ts/lib/Either'
import { pipe } from 'fp-ts/lib/pipeable'
//
const minLength = (s: string): Either<string, string> =>
  s.length >= 6 ? right(s) : left('at least 6 characters')

const oneCapital = (s: string): Either<string, string> =>
  /[A-Z]/g.test(s) ? right(s) : left('at least one capital letter')

const oneNumber = (s: string): Either<string, string> =>
  /[0-9]/g.test(s) ? right(s) : left('at least one number')


const validatePassword = (s: string): Either<string, string> =>
  pipe(
    minLength(s),
    chain(oneCapital),
    chain(oneNumber)
  )

记录这种弃用的变化量g声明:

不推荐使用管道模块,而使用特定的帮助程序。

什么是“特定的帮手”?我该如何处理这个警告?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-05-11 03:10:45

要解决此警告,请从fp-ts/lib/function而不是fp-ts/lib/pipeable导入fp-ts/lib/pipeable

代码语言:javascript
复制
import { pipe } from 'fp-ts/lib/function'
票数 7
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/67480062

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档