Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
321 views
in Technique[技术] by (71.8m points)

typescript中类型不同的问题

按照官方上面的使用方法在koa中引入了koa-generic-sessionkoa-redis两个库
image.png
然而我在使用typescript的时候会出现类型不兼容的错误
image.png
store为SessionStore
image.png
redisStore返回的为RedisSessionStore
image.png

初学typescript 想问一下出现这种情况的话应该怎么解决


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

koa-redis 用了个过时的 koa-generic-session 库,而这过时库的@types更加过时,你要么类型强转(用 as )要么用koa-session


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...