All files / utilities createRef.ts

100% Statements 4/4
100% Branches 0/0
100% Functions 2/2
100% Lines 4/4
1 2 3 4 5 6 7 8 9 10 11 12 13 14          1x   1x 1x     1x    
export interface ComponentRef<T> {
  current: T;
  (val: T): void;
}
 
export function createRef<T>(): ComponentRef<T> {
  //tslint:disable:no-unnecessary-local-variable
  const f: any = (function (x: T) {
    f.current = x;
  });
 
  return f;
}