Akryum / Akryum/vue-cli-plugin-apollo

Why the type of the link property in ApolloClientConfig is string instead of ApolloLink

オープン
#319 コメント 2 件 リアクション 5 件 担当者 0 名 GitHub で見る
主要言語
JavaScript
スター
477
フォーク
109
PR マージ指標
30日以内にマージされた PR はありません

説明

### Question

Why the type of the link property in ApolloClientConfig is String instead of ApolloLink

### Description

I want to use my 'authMiddlewareLink' instead of the default link。
But I got these problems from VSCode

> Type 'ApolloLink' is not assignable to type 'string'.

### Code
```
const authMiddlewareLink = new ApolloLink((operation, forward) => {
const token = getUserToken();
const headers = token ? { 'API-TOKEN': token } : {};
operation.setContext({
headers,
});
return forward(operation);
});

export const { apolloClient } = createApolloClient({
link: authMiddlewareLink,
...defaultOptions,
});
```

### Version
0.21.3

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。