Michael Kang
Michael Kang

Reputation: 52867

What is the difference between Subscription imports

What is the difference between:

import { Subscription } from 'rxjs';

and

import { Subscription } from 'rxjs/Subscription';

It seems both will compile fine without issues. Is one way more correct than the other? Are there any issues to using either?

Upvotes: 0

Views: 26

Answers (1)

user1
user1

Reputation: 1135

It's the same. Using import { Subscription } from 'rxjs'; the Subscription gets imported from the index.ts barrel file and using import { Subscription } from 'rxjs/Subscription'; the Subscription gets imported from the its own file. If you look into the index.ts you can see that exports it export { Subscription } from './internal/Subscription';

Upvotes: 1

Related Questions